JDBC+HTML+AJAX实现登陆和单表的CRUD

news2025/6/4 0:53:33

JDBC+HTML+AJAX实现登陆和单表的CRUD

导入maven依赖

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">  
  <modelVersion>4.0.0</modelVersion>  
  <groupId>com.nie</groupId>  
  <artifactId>Test</artifactId>  
  <version>1.0-SNAPSHOT</version>  
  <packaging>war</packaging>
  <properties> 
    <maven.compiler.source>17</maven.compiler.source>  
    <maven.compiler.target>17</maven.compiler.target>  
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
  </properties>

  <dependencies>
    <dependency>
      <groupId>jakarta.servlet</groupId>
      <artifactId>jakarta.servlet-api</artifactId>
      <version>6.0.0</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>8.0.33</version>
    </dependency>

    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <version>2.10.1</version>
    </dependency>
  </dependencies>
</project>

登陆页面


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户登录</title>
    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <style>
        .container {
            width: 300px;
            margin: 100px auto;
            padding: 20px;
            border: 1px solid #ccc;
            border-radius: 5px;
        }
        .form-group {
            margin-bottom: 15px;
        }
        .form-group label {
            display: block;
            margin-bottom: 5px;
        }
        .form-group input {
            width: 100%;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
        }
        .btn-login {
            background-color: #007bff;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .error-message {
            color: red;
            margin-top: 10px;
            display: none;
        }
    </style>
</head>
<body>
<div class="container">
    <form action="login" method="post" id="loginForm">
        <div class="form-group">
            <label for="username">用户名:</label>
            <input type="text" id="username" name="username" required>
        </div>
        <div class="form-group">
            <label for="password">密码:</label>
            <input type="password" id="password" name="password" required>
        </div>
        <button type="submit" class="btn-login">登录</button>
    </form>
    <div id="errorMessage" class="error-message"></div>
</div>
</body>
<script>
    $(document).ready(function () {
        $("#loginForm").submit(function () {
            var username = $("#username").val();
            var password = $("#password").val();

            $.ajax({
                type: "POST",
                url: "/login",
                dataType: "text",
                data: { username: username, password: password },
                success: function (response) {
                    if (response === "success") {
                        window.location.href = "Test1.html";
                    }
                }
            })
        })
    })
</script>
</html> 

学生信息页面

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>学生信息表</title>
    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<div></div>
<div>
    <input type="text" id="names" placeholder="输入学生姓名">
    <button id="chaxun">查询姓名</button>
    <button id="all">查询所有</button>
    <table width="50%" border="1">
        <tr align="center">
            <td>学号</td>
            <td>姓名</td>
            <td>性别</td>
            <td>邮箱</td>
        </tr>
        <tbody id="test">
        </tbody>
    </table>
</div>
<div>
    学号:<input type="text" name="" id="id">
    姓名:<input type="text" name="" id="name">
    性别:<input type="text" name="" id="sex">
    邮箱:<input type="text" name="" id="email"><br>
    <button id="insert">新增数据</button>
</div>
<script>
    function deleteStudent(id) {
        $.ajax({
            url: '/delete',
            type: "POST",
            dataType: "text",
            data: { id: id },
            success: function (data) {
                if (data === "success") {
                    alert("数据删除成功!");
                    $("#all").click()
                } else {
                    alert("删除数据失败!");
                }
            },
            error: function () {
                alert("删除数据失败!");
            }
        })
    }
    function updateStudent(id) {
        let id1=document.getElementById("id").value
        let name=document.getElementById("name").value
        let sex=document.getElementById("sex").value
        let email=document.getElementById("email").value
        $.ajax({
            url: '/update',
            type: "POST",
            dataType: "text",
            data: { id: id ,id1:id1,name:name,sex:sex,email:email},
            success: function (data) {
                if (data === "success") {
                    alert("数据修改成功!");
                    $("#all").click()
                } else {
                    alert("数据修改失败!");
                }
            },
            error: function () {
                alert("数据修改失败!");
            }
        })
    }
    $(document).ready(function () {
        $("#all").click(function () {
            $.ajax({
                url: './api/students',
                type: "GET",
                dataType: "json",
                success: function (data) {
                    console.log("Received data:", data);
                    var html = "";
                    for (var i = 0; i < data.length; i++) {
                        var ls = data[i];
                        html +=
                            "<tr>" +
                            "<td>" + ls.id + "</td>" +
                            "<td>" + ls.name + "</td>" +
                            "<td>" + ls.sex + "</td>" +
                            "<td>" + ls.email + "</td>" +
                            "<td>" +
                            "<button onclick='deleteStudent(" + ls.id + ")'>删除</button>" +
                            "<button onclick='updateStudent(" + ls.id + ")'>修改</button>" +
                            "</td>" +
                            "</tr>";
                    }
                    $("#test").html(html);
                },
                error: function (xhr, status, error) {
                    console.error("Error details:", {
                        status: xhr.status,
                        statusText: xhr.statusText,
                        responseText: xhr.responseText
                    });
                    alert("获取数据失败,请检查控制台错误信息");
                }
            });

        });

        $("#chaxun").click(function () {
            var names = document.getElementById("names").value;
            $.ajax({
                url: './api/studentsByName',
                type: "GET",
                dataType: "json",
                data: { name: names },
                success: function (data) {
                    console.log("Received data:", data);
                    var html = "";
                    for (var i = 0; i < data.length; i++) {
                        var ls = data[i];
                        html +=
                            "<tr>" +
                            "<td>" + ls.id + "</td>" +
                            "<td>" + ls.name + "</td>" +
                            "<td>" + ls.sex + "</td>" +
                            "<td>" + ls.email + "</td>" +
                            "</tr>";
                    }
                    $("#test").html(html);
                },
                error: function () {
                    alert("获取数据失败");
                }
            });
        });
        $("#insert").click(function (){
            var id = document.getElementById("id").value; // 获取输入框的值
            var name = document.getElementById("name").value; // 获取输入框的值
            var sex = document.getElementById("sex").value; // 获取输入框的值
            var email = document.getElementById("email").value; // 获取输入框的值
            $.ajax({
                type: "POST",
                url: '/insert',
                dataType: "text",
                data: { id: id, name: name, sex: sex, email: email },
                success: function (response) {
                    if (response === "success") {
                        alert("数据新增成功!");
                        $("#all").click();
                    } else {
                        alert("新增数据失败!");
                    }
                },
                error: function () {
                    alert("新增数据失败!");
                }
            });
        });
    });
</script>
</body>
</html>

JDBC连接数据库

package com.nie.utils;


import java.sql.*;

public class GetConnection {

    private static String url="jdbc:mysql://127.0.0.1:3306/student";
    private static String user="root";
    private static String password="123456";

    static {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }

    public static Connection getConnection() throws SQLException {
        return DriverManager.getConnection(url,user,password);
    }

    public void close(Connection conn, PreparedStatement stmt, ResultSet rs) throws SQLException {
        conn.close();
        stmt.close();
        rs.close();
    }

}

登陆实体类

package com.nie.pojo;

public class loginStudent {
    private String username;
    private String password;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}

学生实体类

package com.nie.pojo;

public class student {
    private String id;
    private String name;
    private String sex;
    private String email;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String age) {
        this.sex = age;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public String toString() {
        return "student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age='" + sex + '\'' +
                ", email='" + email + '\'' +
                '}';
    }
}

dao层

package com.nie.dao;

import com.nie.pojo.loginStudent;
import com.nie.pojo.student;
import com.nie.utils.GetConnection;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class StudentDao {
    static Connection conn = null;
    static PreparedStatement pstmt = null;
    static ResultSet rs = null;

    public static List<student> selectAll() throws SQLException {
        conn= GetConnection.getConnection();
        List<student> list = new ArrayList<student>();
        pstmt=conn.prepareStatement("select * from student");
        rs=pstmt.executeQuery();
        while (rs.next()) {
            student student = new student();
            student.setId(rs.getString("id"));
            student.setName(rs.getString("name"));
            student.setSex(rs.getString("sex"));
            student.setEmail(rs.getString("email"));
            list.add(student);
        }
        return list;
    }

    public static List<student> selectByName(String name) throws SQLException {
        conn=GetConnection.getConnection();
        pstmt=conn.prepareStatement("select  * from student where name = ?");
        pstmt.setString(1, name);
        rs=pstmt.executeQuery();
        List<student> list=new ArrayList<>();
        while (rs.next()) {
            student student = new student();
            student.setId(rs.getString("id"));
            student.setName(rs.getString("name"));
            student.setSex(rs.getString("sex"));
            student.setEmail(rs.getString("email"));
            list.add(student);
        }
        return list;
    }

    public static int insertStudent(student student) throws SQLException {
        conn=GetConnection.getConnection();
        pstmt=conn.prepareStatement("insert into student (id,name,sex,email) values(?,?,?,?)");
        pstmt.setString(1,student.getId());
        pstmt.setString(2,student.getName());
        pstmt.setString(3,student.getSex());
        pstmt.setString(4,student.getEmail());
        int i = pstmt.executeUpdate();
        return i;
    }

    public static List<loginStudent>  selectslogin(loginStudent loginStudent) throws SQLException {
        conn=GetConnection.getConnection();
        pstmt=conn.prepareStatement("select * from login where username = ? and password = ?");
        pstmt.setString(1,loginStudent.getUsername());
        pstmt.setString(2,loginStudent.getPassword());
        rs=pstmt.executeQuery();
        List<loginStudent> list=new ArrayList<>();
        if(rs.next()) {
            loginStudent login = new loginStudent();
            login.setUsername(rs.getString("username"));
            login.setPassword(rs.getString("password"));
            list.add(login);
        }
        return list;
    }

    public static int DeleteStudent(String id) throws SQLException {
        conn=GetConnection.getConnection();
        pstmt=conn.prepareStatement("delete from student where id = ?");
        pstmt.setString(1,id);
        int i = pstmt.executeUpdate();
        return i;
    }

    public static int UpdateStudent(String id,String id1,String name,String sex,String email) throws SQLException {
        conn=GetConnection.getConnection();
        pstmt=conn.prepareStatement("update student set id=?,name=?,sex=?,email=? where id=?");
        pstmt.setString(1,id1);
        pstmt.setString(2,name);
        pstmt.setString(3,sex);
        pstmt.setString(4,email);
        pstmt.setString(5,id);
        int i = pstmt.executeUpdate();
        return i;
    }
}

业务层

删除

package com.nie.server;

import com.nie.dao.StudentDao;
import com.sun.net.httpserver.HttpsServer;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.sql.SQLException;


@WebServlet("/delete")
public class DeleteStudent extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        try {
            int i = StudentDao.DeleteStudent(id);
            if(i>0){
                resp.getWriter().write("success");
            }else {
                resp.getWriter().write("fail");
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }

    }
}

添加

package com.nie.server;

import com.nie.dao.StudentDao;
import com.nie.pojo.student;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.sql.SQLException;

@WebServlet("/insert")
public class InsertStudent extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        String name = req.getParameter("name");
        String sex = req.getParameter("sex");
        String email = req.getParameter("email");
        student student = new student();
        student.setId(id);
        student.setName(name);
        student.setSex(sex);
        student.setEmail(email);

        try {
            int i = StudentDao.insertStudent(student);
            if (i > 0) {
                resp.getWriter().write("success");
            } else {
                resp.getWriter().write("fail");
            }
        } catch (SQLException e) {
            e.printStackTrace();
            resp.getWriter().write("fail");
        }
    }
}


登陆

package com.nie.server;

import com.nie.dao.StudentDao;
import com.nie.pojo.loginStudent;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;
import java.util.List;

@WebServlet("/login")
public class loginServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String username = req.getParameter("username");
        String password = req.getParameter("password");
        loginStudent loginStudent = new loginStudent();
        loginStudent.setUsername(username);
        loginStudent.setPassword(password);

        try {
            List<loginStudent> selectslogin = StudentDao.selectslogin(loginStudent);
            if(selectslogin.size()>0) {
                resp.getWriter().write("success");
            }else {
                resp.getWriter().write("fail");
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }
}

查询

package com.nie.server;

import com.google.gson.Gson;
import com.nie.dao.StudentDao;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.sql.SQLException;

@WebServlet("/api/students")
public class ServletStudent extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String name = req.getParameter("name");

        Gson gson = new Gson();
        String jsonResponse = null;
        try {
            if (name != null){
                jsonResponse = gson.toJson(StudentDao.selectByName(name));
            }else {
                jsonResponse = gson.toJson(StudentDao.selectAll());
            }

        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
        // 设置响应头,确保返回JSON
        resp.setContentType("application/json");
        resp.setCharacterEncoding("UTF-8");
        // 添加CORS头,允许跨域访问(如果需要的话)
        resp.setHeader("Access-Control-Allow-Origin", "*");
        resp.getWriter().write(jsonResponse);
    }


    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}

根据姓名查询

package com.nie.server;

import com.google.gson.Gson;
import com.nie.dao.StudentDao;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.sql.SQLException;

@WebServlet("/api/studentsByName")
public class ServletStudentByName extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String name = req.getParameter("name");

        Gson gson = new Gson();
        String jsonResponse = null;
        try {
            jsonResponse = gson.toJson(StudentDao.selectByName(name));
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
        // 设置响应头,确保返回JSON
        resp.setContentType("application/json");
        resp.setCharacterEncoding("UTF-8");
        // 添加CORS头,允许跨域访问(如果需要的话)
        resp.setHeader("Access-Control-Allow-Origin", "*");
        resp.getWriter().write(jsonResponse);
    }


    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}

修改

package com.nie.server;

import com.nie.dao.StudentDao;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.sql.SQLException;

@WebServlet("/update")
public class UpdateStudent extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        String id1 = req.getParameter("id1");
        String name = req.getParameter("name");
        String sex = req.getParameter("sex");
        String email = req.getParameter("email");
        try {
            int i = StudentDao.UpdateStudent(id, id1, name, sex, email);
            if (i>0) {
                resp.getWriter().write("success");
            } else {
                resp.getWriter().write("fail");
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}

最终效果:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2395491.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【C++】位图详解(一文彻底搞懂位图的使用方法与底层原理)

&#x1f308; 个人主页&#xff1a;谁在夜里看海. &#x1f525; 个人专栏&#xff1a;《C系列》《Linux系列》 ⛰️ 天高地阔&#xff0c;欲往观之。 目录 1.位图的概念 2.位图的使用方法 定义与创建 设置和清除 位访问和检查 转换为其他格式 3.位图的使用场景 1.快速…

【笔记】开源通用人工智能代理 Suna 部署全流程准备清单(Windows 系统)

#工作记录 一、基础工具与环境 开发工具 Git 或 GitHub Desktop&#xff08;代码管理&#xff09;Docker Desktop&#xff08;需启用 WSL2&#xff0c;容器化部署&#xff09;Python 3.11&#xff08;推荐版本&#xff0c;需添加到系统环境变量&#xff09;Node.js LTS&#xf…

海康工业相机SDK二次开发(VS+QT+海康SDK+C++)

前言 工业相机在现代制造和工业自动化中扮演了至关重要的角色&#xff0c;尤其是在高精度、高速度检测中。海康威视工业相机以其性能稳定、图像质量高、兼容性强而受到广泛青睐。特别是搞机器视觉的小伙伴们跟海康打交道肯定不在少数&#xff0c;笔者在平常项目中跟海康相关人…

深度学习|pytorch基本运算-乘除法和幂运算

【1】引言 前序学习进程中&#xff0c;已经对pytorch张量数据的生成和广播做了详细探究&#xff0c;文章链接为&#xff1a; 深度学习|pytorch基本运算-CSDN博客 深度学习|pytorch基本运算-广播失效-CSDN博客 上述探索的内容还止步于张量的加减法&#xff0c;在此基础上&am…

4.2.4 Spark SQL 数据写入模式

在本节实战中&#xff0c;我们详细探讨了Spark SQL中数据写入的四种模式&#xff1a;ErrorIfExists、Append、Overwrite和Ignore。通过具体案例&#xff0c;我们演示了如何使用mode()方法结合SaveMode枚举类来控制数据写入行为。我们首先读取了一个JSON文件生成DataFrame&#…

论文笔记: Urban Region Embedding via Multi-View Contrastive Prediction

AAAI 2024 1 INTRO 之前基于多视图的region embedding工作大多遵循相同的模式 单独的单视图表示多视图融合 但这种方法存在明显的局限性&#xff1a;忽略了不同视图之间的信息一致性 一个区域的多个视图所携带的信息是高度相关的&#xff0c;因此它们的表示应该是一致的如果能…

初学者如何微调大模型?从0到1详解

本文将手把手带你从0到1&#xff0c;详细解析初学者如何微调大模型&#xff0c;让你也能驾驭这些强大的AI工具。 1. 什么是大模型微调&#xff1f; 想象一下&#xff0c;预训练大模型就像一位博览群书但缺乏专业知识的通才。它掌握了海量的通用知识&#xff0c;但可能无法完美…

西瓜书第十一章——降维与度量学习

文章目录 降维与度量学习k近邻学习原理头歌实战-numpy实现KNNsklearn实现KNN 降维——多维缩放&#xff08;Multidimensional Scaling, MDS&#xff0c;MDS&#xff09;提出背景与原理重述1.**提出背景**2.**数学建模与原理推导**3.**关键推导步骤** Principal Component Analy…

Portainer安装指南:多节点监控的docker管理面板-家庭云计算专家

背景 Portainer 是一个轻量级且功能强大的容器管理面板&#xff0c;专为 Docker 和 Kubernetes 环境设计。它通过直观的 Web 界面简化了容器的部署、管理和监控&#xff0c;即使是非技术用户也能轻松上手。Portainer 支持多节点管理&#xff0c;允许用户从一个中央控制台管理多…

vscode实用配置

前端开发安装插件&#xff1a; 1.可以更好看的显示文件图标 2.用户快速打开文件 使用步骤&#xff1a;在html文件下右键点击 open with live server 即可 刷力扣&#xff1a; 安装这个插件 还需要安装node.js即可

React 项目中封装 Excel 导入导出组件:技术分享与实践

文章目录 前言一、为什么需要封装 Excel 组件&#xff1f;二、技术选型三、核心实现1. 安装依赖2. 封装Excel导出3. 封装导入组件 &#xff08;UploadExcel&#xff09; 总结 前言 在 React 项目中&#xff0c;处理 Excel 文件的导入和导出是常见的业务需求。无论是导出报表数…

【2025CCF中国开源大会】RISC-V 开源生态的挑战与机遇分论坛重磅来袭!共探开源芯片未来

点击蓝字 关注我们 CCF Opensource Development Committee 开源浪潮正从软件席卷硬件领域&#xff0c;RISC-V作为全球瞩目的开源芯片架构&#xff0c;正在重塑计算生态的版图&#xff01;相较于成熟的x86与ARM&#xff0c;RISC-V生态虽处爆发初期&#xff0c;却蕴藏着无限可能。…

python完成批量复制Excel文件并根据另一个Excel文件中的名称重命名

import openpyxl import shutil import os # 原始文件路径 original_file "C:/Users/Administrator/Desktop/事业联考面试名单/郑州.xlsx" # 读取包含名称的Excel文件 # 修改为您的文件名 wb openpyxl.load_workbook( "C:/Users/Administrator/Desktop/事…

Vue-2-前端框架Vue基础入门之二

文章目录 1 计算属性1.1 计算属性简介1.2 计算属性示例 2 侦听器2.1 简单的侦听器2.2 深度监听2.3 监听对象单个属性 3 vue-cli3.1 工程化的Vue项目3.2 Vue项目的运行流程 4 vue组件4.1 Vue组件的三个部分4.1.1 template4.1.2 script4.1.3 style 4.2 组件之间的关系4.2.1 使用组…

CPT208 Human-Centric Computing 人机交互 Pt.7 交互和交互界面

文章目录 1. 界面隐喻&#xff08;Interface metaphors&#xff09;1.1 界面隐喻的应用方式1.2 界面隐喻的优缺点 2. 交互类型2.1 Instructing&#xff08;指令式交互&#xff09;2.2 Conversing&#xff08;对话式交互&#xff09;2.3 Manipulating&#xff08;操作式交互&…

[网页五子棋][匹配模块]前后端交互接口(消息推送机制)、客户端开发(匹配页面、匹配功能)

让多个用户&#xff0c;在游戏大厅中能够进行匹配&#xff0c;系统会把实力相近的两个玩家凑成一桌&#xff0c;进行对战 约定前后端交互接口 消息推送机制 匹配这样的功能&#xff0c;也是依赖消息推送机制的 玩家 1 点击开始匹配按钮&#xff0c;就会告诉服务器&#xff1…

【数据分析】Matplotlib+Pandas+Seaborn绘图

【数据分析】MatplotlibPandasSeaborn绘图 &#xff08;一&#xff09;Matplotlib绘图1.1 matplotlib绘图方式1: 状态接口1.2 matplotlib绘图方式2: 面向对象1.3 通过安斯科姆数据集, 说明可视化的重要性1.4 MatPlotlib绘图-单变量-直方图1.5 MatPlotlib绘图-双变量-散点图1.6 …

NLP学习路线图(十五):TF-IDF(词频-逆文档频率)

在自然语言处理&#xff08;NLP&#xff09;的浩瀚宇宙中&#xff0c;TF-IDF&#xff08;词频-逆文档频率&#xff09; 犹如一颗恒星&#xff0c;虽古老却依然璀璨。当ChatGPT、BERT等大模型光芒四射时&#xff0c;TF-IDF作为传统方法的代表&#xff0c;其简洁性、高效性与可解…

[Redis] Redis命令在Pycharm中的使用

初次学习&#xff0c;如有错误还请指正 目录 String命令 Hash命令 List命令 set命令 SortedSet命令 连接pycharm的过程见&#xff1a;[Redis] 在Linux中安装Redis并连接桌面客户端或Pycharm-CSDN博客 redis命令的使用见&#xff1a;[Redis] Redis命令&#xff08;1&#xf…

openpnp - 给M4x0.7mm的直油嘴加油的工具选择

文章目录 openpnp - 给M4x0.7mm的直油嘴加油的工具选择概述如果换上带卡口的M4x0.7直油嘴END openpnp - 给M4x0.7mm的直油嘴加油的工具选择 概述 X导轨用了一个HG15的滑块 滑块上的注油口的黄油嘴是M4x0.7mm的直油嘴。 外表面是6边形的柱子&#xff0c;没有可以卡住加油嘴工…