欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jsp、servlet前后端交互對數(shù)據(jù)處理及展示的簡單實(shí)現(xiàn)

 更新時(shí)間:2023年12月07日 10:59:46   作者:奮斗著,享受著  
Servlet和JSP是Java Web開發(fā)中的兩個重要概念,在Servlet和JSP中前后端交互可以通過一些方式來實(shí)現(xiàn),這篇文章主要給大家介紹了關(guān)于jsp、servlet前后端交互對數(shù)據(jù)處理及展示的簡單實(shí)現(xiàn),需要的朋友可以參考下

代碼框架介紹:

后端部分:

  • beans:實(shí)體類,存放各個數(shù)據(jù)庫表單的實(shí)體類;
  • dao:接口部分:創(chuàng)建對實(shí)體類對象的增刪改查的方法接口。
  • impl部分:具體實(shí)現(xiàn)接口的方法,方便調(diào)用。
  • servlet: 接受處理前端頁面?zhèn)鱽淼臄?shù)據(jù),并在處理結(jié)束后響應(yīng)前端頁面。
  • test:負(fù)責(zé)后端代碼測試。
  • utis工具模塊:由于JDBC連接及數(shù)據(jù)處理存在大量重復(fù),故提取其中重復(fù)部分代碼封裝作為工具類被impl中的類調(diào)用以簡化代碼。

前端部分:

  • lib:存放前端及jsp、servlet所需jar包;
  • web.xml:用來指定默認(rèn)首頁及建立后端servlet與前端代碼之間的映射連接;
  • index.jsp:默認(rèn)首頁(內(nèi)含登錄(還未實(shí)現(xiàn)),注冊,數(shù)據(jù)展示功能);
  • register.jsp:注冊頁面,填寫相關(guān)信息點(diǎn)擊注冊, 跳轉(zhuǎn)到數(shù)據(jù)展示頁面,完成注冊。
  • StudentList.jsp:數(shù)據(jù)展示,將表中所有數(shù)據(jù)讀取并展示到頁面。(內(nèi)含數(shù)據(jù)修改和刪除功能)
  • updatestu.jsp:數(shù)據(jù)修改更新,在數(shù)據(jù)展示頁面點(diǎn)擊修改自動跳轉(zhuǎn)到此頁面,根據(jù)學(xué)號修改相關(guān)信息,修改后提交繼續(xù)跳轉(zhuǎn)到數(shù)據(jù)展示頁面展示更新后的數(shù)據(jù)并同步到數(shù)據(jù)庫。

代碼展示:(以Student為例)

后端:

實(shí)體類:

package com.openlab.beans;
//也可使用limbok插件簡化代碼,通過注解省略get set方法的書寫
public class Student {
    private  String StudentNo  ;
    private  String LoginPwd   ;
    private  String StudentName;
    private  String Sex        ;
    private  Integer GradeId    ;
    private  String Phone      ;
    private  String Address    ;
    private  String BornDate   ;
    private  String Email      ;
 
    public Student() {
    }
 
    public Student(String studentNo,  String loginPwd, String studentName, String sex, Integer gradeId, String phone, String address, String bornDate, String email) {
        StudentNo = studentNo;
        LoginPwd = loginPwd;
        StudentName = studentName;
        Sex = sex;
        GradeId = gradeId;
        Phone = phone;
        Address = address;
        BornDate = bornDate;
        Email = email;
    }
 
    public String getStudentNo() {
        return StudentNo;
    }
 
    public void setStudentNo(String studentNo) {
        StudentNo = studentNo;
    }
 
    public String getLoginPwd() {
        return LoginPwd;
    }
 
    public void setLoginPwd(String loginPwd) {
        LoginPwd = loginPwd;
    }
 
    public String getStudentName() {
        return StudentName;
    }
 
    public void setStudentName(String studentName) {
        StudentName = studentName;
    }
 
    public String getSex() {
        return Sex;
    }
 
    public void setSex(String sex) {
        Sex = sex;
    }
 
    public Integer getGradeId() {
        return GradeId;
    }
 
    public void setGradeId(Integer gradeId) {
        GradeId = gradeId;
    }
 
    public String getPhone() {
        return Phone;
    }
 
    public void setPhone(String phone) {
        Phone = phone;
    }
 
    public String getAddress() {
        return Address;
    }
 
    public void setAddress(String address) {
        Address = address;
    }
 
    public String getBornDate() {
        return BornDate;
    }
 
    public void setBornDate(String bornDate) {
        BornDate = bornDate;
    }
 
    public String getEmail() {
        return Email;
    }
 
    public void setEmail(String email) {
        Email = email;
    }
 
    @Override
    public String toString() {
        return "Student{" +
                "StudentNo='" + StudentNo + '\'' +
                ", LoginPwd='" + LoginPwd + '\'' +
                ", StudentName='" + StudentName + '\'' +
                ", Sex='" + Sex + '\'' +
                ", GradeId=" + GradeId +
                ", Phone='" + Phone + '\'' +
                ", Address='" + Address + '\'' +
                ", BornDate='" + BornDate + '\'' +
                ", Email='" + Email + '\'' +
                '}';
    }
}

接口類:

package com.openlab.dao;
 
import com.openlab.beans.Student;
 
import java.util.List;
 
public interface StudentDao {
    public  int save(Student student);//插入學(xué)生信息
    public  int update(Student student);//更新學(xué)生信息(通過學(xué)生學(xué)號)
    public int delete(String stuid);//通過學(xué)號刪除學(xué)生信息
    public List<Student> getAll();//獲取所有學(xué)生信息
    public  Student findById(String stuid);//通過id查找指定學(xué)生信息
}

工具類:

package com.openlab.utils;
 
import com.alibaba.druid.pool.DruidDataSourceFactory;
import javax.sql.DataSource;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
 
public class JDBCUtils {
    static Properties properties = new Properties();
    static DataSource dataSource = null;
 
    static {
        InputStream inputStream = JDBCUtils.class.getClassLoader().getResourceAsStream("druid.properties");
 
        try {
            properties.load(inputStream);
            dataSource = DruidDataSourceFactory.createDataSource(properties);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
    public Connection getConnection() throws Exception {
        try {
 
            Connection connection = dataSource.getConnection();
 
            return connection;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
 
    //新增成功后返回新增的主鍵
    public int save(String sql, Object... params) {
        Connection connection = null;
        PreparedStatement preparedStatement = null;
        ResultSet rs = null;
        int id = -1;
        try {
            connection = getConnection();
            preparedStatement = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
            setParameter(preparedStatement, params);
            preparedStatement.executeUpdate();
            rs = preparedStatement.getGeneratedKeys();
            if (rs.next()) {
                Object obj = rs.getObject(1);
                id = Integer.parseInt(obj.toString());
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            close(connection, preparedStatement, rs);
        }
        return id;
    }
 
    public int executeUpdate(String sql, Object... params) {
        Connection connection = null;
        PreparedStatement preparedStatement = null;
        try {
            connection = getConnection();
            preparedStatement = connection.prepareStatement(sql);
            setParameter(preparedStatement, params);
//            System.out.println(sql);
            int rows = preparedStatement.executeUpdate();
            return rows;
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            close(connection, preparedStatement, null);
        }
        return -1;
    }
 
    public <T> T findOneById(Class<T> tClass, String sql, Object... params) {
        List<T> list = executeQuery(tClass, sql, params);
        if (list != null && list.size() > 0) {
            return list.get(0);
        } else {
            return null;
        }
    }
 
    public <T> List<T> executeQuery(Class<T> tClass, String sql, Object... params) {
        List<T> list = new ArrayList<>();
        Connection connection = null;
        PreparedStatement preparedStatement = null;
        ResultSet rs = null;
        try {
            connection = getConnection();
            preparedStatement = connection.prepareStatement(sql);
            setParameter(preparedStatement, params);
            rs = preparedStatement.executeQuery();
            while (rs.next()) {
                T t = tClass.newInstance();
                ResultSetMetaData rsmd = rs.getMetaData();
                int count = rsmd.getColumnCount();
                for (int i = 1; i <= count; i++) {
                    String label = rsmd.getColumnLabel(i);
                    Object v = rs.getObject(label);
                    //
//                    String fieldname = change(label);
                    String fieldname = label;
                    Field field = tClass.getDeclaredField(fieldname);
                    field.setAccessible(true);
                    field.set(t, v);
                }
                list.add(t);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            close(connection, preparedStatement, rs);
        }
 
        return list;
    }
 
    /**
     * 如果表中的列是全部小寫的 empid --->empid
     * _        emp_id--->empId
     * EMPID--->empid
     *
     * @param label
     * @return
     */
    private static String change(String label) {
        int index = label.indexOf("_");
        String fieldname = "";
        if (index != -1) {
            fieldname = label.substring(0, index) + label.substring(index + 1, index + 2).toUpperCase() + label.substring(index + 2);
 
        } else {//沒找到
            fieldname = label.toLowerCase();
        }
        return fieldname;
    }
 
    private void setParameter(PreparedStatement preparedStatement, Object... params) {
        try {
            if (params != null && params.length > 0) {
                for (int i = 0; i < params.length; i++) {
//                    System.out.println(params[i]);
                    preparedStatement.setObject(i + 1, params[i]);
                }
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
 
 
    public void close(Connection connection, Statement statement, ResultSet rs) {
        try {
            if (rs != null) {
                rs.close();
            }
            if (statement != null) {
                statement.close();
            }
            if (connection != null) {
                connection.close();
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}

實(shí)現(xiàn)類:

package com.openlab.dao.impl;
 
import com.openlab.beans.Student;
import com.openlab.utils.JDBCUtils;
 
import java.util.List;
 
public class StudentDao implements com.openlab.dao.StudentDao {
    @Override
    public int save(Student student) {
        return new JDBCUtils().save("insert into student values(?,?,?,?,?,?,?,?,?)",student.getStudentNo(),student.getLoginPwd(),student.getStudentName(),student.getSex(),student.getGradeId(),student.getPhone(),student.getAddress(),student.getBornDate(),student.getEmail());
    }
 
    @Override
    public int update(Student student) {
//        System.out.println(student.getStudentName()+student.getLoginPwd()+student.getSex()+student.getGradeId()+student.getPhone()+student.getAddress()+student.getBornDate()+student.getEmail()+student.getStudentNo());
        return new JDBCUtils().executeUpdate("update student set StudentName = ?,LoginPwd = ? ,Sex = ?, GradeId = ?, Phone = ?, Address = ?, BornDate = ?, Email = ? where StudentNo = ?" ,student.getStudentName(),student.getLoginPwd(),student.getSex(),student.getGradeId(),student.getPhone(),student.getAddress(),student.getBornDate(),student.getEmail(),student.getStudentNo());
    }
 
    @Override
    public int delete(String stuid) {
        return new JDBCUtils().executeUpdate("delete from student where StudentNo = ?",stuid);
    }
 
    @Override
    public List<Student> getAll() {
        return new JDBCUtils().executeQuery(Student.class,"select * from student");
    }
 
    @Override
    public Student findById(String stuid) {
        return new JDBCUtils().findOneById(Student.class,"select * from student where StudentNo = ? ",stuid);
    }
}

servlet類:

增加:

package com.openlab.sevlet;
 
import com.openlab.beans.Student;
import com.openlab.dao.impl.StudentDao;
 
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
 
@WebServlet(name = "Servlet", value = "/Servlet")
public class addStudentServlet extends HttpServlet {
    StudentDao studentDao = new StudentDao();
 
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        //獲取參數(shù)
//        System.out.println(request.getParameter("StudentNo"));
        String studentNo = request.getParameter("StudentNo");
        String loginPwd = request.getParameter("LoginPwd");
        String studentName = request.getParameter("StudentName");
        String sex = request.getParameter("sex");
        if(sex.equals("f")){
            sex = "女";
        }else {
            sex = "男";
        }
        String gradeId = request.getParameter("GradeId");
        String phone = request.getParameter("Phone");
        String address = request.getParameter("Address");
        String bornDate = request.getParameter("BornDate");
        String email = request.getParameter("Email");
        Student student = new Student(studentNo,loginPwd,studentName,sex,Integer.valueOf(gradeId),phone,address,bornDate,email);
        //插入數(shù)據(jù)
        studentDao.save(student);
//        System.out.println(update);
        //響應(yīng)頁面
        response.sendRedirect("Studentlist.jsp");
 
    }
}

刪除:

package com.openlab.sevlet;
 
import com.openlab.dao.impl.StudentDao;
 
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
 
@WebServlet(name = "Servlet2", value = "/Servlet2")
public class deleteStudentServlet extends HttpServlet {
 
StudentDao studentDao = new StudentDao();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        //獲取參數(shù)
        String studentNo = request.getParameter("stuid");
        //刪除數(shù)據(jù)
        studentDao.delete(studentNo);
        //響應(yīng)頁面
        response.sendRedirect("Studentlist.jsp");
 
    }
}

修改:

package com.openlab.sevlet;
 
import com.openlab.beans.Student;
import com.openlab.dao.impl.StudentDao;
 
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
 
@WebServlet(name = "updateStudentServlet", value = "/updateStudentServlet")
public class updateStudentServlet extends HttpServlet {
    StudentDao studentDao = new StudentDao();
 
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        //獲取參數(shù)
        String studentNo = request.getParameter("StudentNo");
        String selecttext = request.getParameter("selecttext");
        Student student = studentDao.findById(studentNo);
        String selectid = request.getParameter("selectid");
        switch (selectid){
            case "1": student.setLoginPwd(selecttext);break;
            case "2":student.setStudentName(selecttext);break;
            case "3":student.setSex(selecttext);break;
            case "4":student.setGradeId(Integer.parseInt(selecttext));break;
            case "5":student.setPhone(selecttext);break;
            case "6":student.setAddress(selecttext);break;
            case "7":student.setBornDate(selecttext);break;
            case "8":student.setEmail(selecttext);break;
            default:
                System.out.println("輸入id有誤?。?!");
        }
        //插入數(shù)據(jù)
        studentDao.update(student);
        //響應(yīng)頁面
        response.sendRedirect("Studentlist.jsp");
    }
}
 

前端:

web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">
     <!--默認(rèn)首頁-->
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
<!--建立映射-->
    <servlet>
        <servlet-name>addStudentServlet</servlet-name>
        <servlet-class>com.openlab.sevlet.addStudentServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>addStudentServlet</servlet-name>
        <url-pattern>/addstu.do</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>deleteStudentServlet</servlet-name>
        <servlet-class>com.openlab.sevlet.deleteStudentServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>deleteStudentServlet</servlet-name>
        <url-pattern>/delestu.do</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>updateStudentServlet</servlet-name>
        <servlet-class>com.openlab.sevlet.updateStudentServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>updateStudentServlet</servlet-name>
        <url-pattern>/updatestu.do</url-pattern>
    </servlet-mapping>
</web-app>

首頁:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>首頁</title>
  </head>
  <body>
  <p>登錄</p>
  <p><a href="register.jsp" rel="external nofollow" >注冊</a></p>
  <p><a href="Studentlist.jsp" rel="external nofollow" >數(shù)據(jù)展示</a></p>
 
  </body>
</html>

注冊頁面:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>注冊</title>
</head>
<body>
<form action="addstu.do" method="post">
    <p>學(xué)號:<input type="text" name="StudentNo"></p>
    <p>密碼:<input type="text" name="LoginPwd"></p>
    <p>姓名:<input type="text" name="StudentName"></p>
    <p>性別:<input type="radio" name="sex" value="m">男
            <input type="radio" name="sex" value="f">女
    </p>
    <p>年級:<input type="text" name="GradeId"></p>
    <p>電話:<input type="text" name="Phone"></p>
    <p>住址:<textarea rows="5" cols="50" name="Address"></textarea></p>
    <p>生日:<input type="text" name="BornDate"></p>
    <p>郵箱:<input type="text" name="Email"></p>
    <p><input type="submit" value="注冊"/> </p>
</form>
</body>
</html>

數(shù)據(jù)展示:

<%@ page import="java.util.ArrayList" %>
<%@ page import="com.openlab.beans.Student" %>
<%@ page import="java.util.List" %>
<%@ page import="com.openlab.dao.impl.StudentDao" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>展示</title>
</head>
<body>
<%
    List<Student> list = new ArrayList<>();
    StudentDao studentDao = new StudentDao();
    List<Student> all = studentDao.getAll();
    for (Student student : all) {
        list.add(student);
    }
%>
<table border="1" width="600" cellspacing="0" style="color: red">
    <tr align="center">
        <td>學(xué)號</td>
        <td>密碼</td>
        <td>姓名</td>
        <td>性別</td>
        <td>年級</td>
        <td>電話</td>
        <td>住址</td>
        <td>生日</td>
        <td>郵件</td>
        <td colspan="2">操作</td>
    </tr>
    <%
        for (Student student : list){
    %>
    <tr align="center">
        <td><%= student.getStudentNo()%></td>
        <td><%= student.getLoginPwd()%></td>
        <td><%= student.getStudentName()%></td>
        <td><%= student.getSex()%></td>
        <td><%= student.getGradeId()%></td>
        <td><%= student.getPhone()%></td>
        <td><%= student.getAddress()%></td>
        <td><%= student.getBornDate()%></td>
        <td><%= student.getEmail()%></td>
        <td>
            <a href="updatestu.jsp?stuid=<%=student.getStudentNo()%>" rel="external nofollow" >修改</a>
        </td>
        <td>
            <a href="delestu.do?stuid=<%=student.getStudentNo()%>" rel="external nofollow" >刪除</a>
        </td>
 
    </tr>
    <%
        }
    %>
</table>
</body>
</html>

數(shù)據(jù)修改:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>更新</title>
</head>
<body>
<form action="updatestu.do?StudentNo=<%=request.getParameter("stuid")%>" method="post">
  <p>修改的學(xué)生學(xué)號:<%=request.getParameter("stuid")%></p>
  <p>請輸入你要修改的字段<input type="text" name="selectid"></p>
  <p>請輸入修改后的字段內(nèi)容<input type="text" name="selecttext"></p>
  <p>密碼:1</p>
  <p>姓名:2</p>
  <p>性別:3</p>
  <p>年級:4</p>
  <p>電話:5</p>
  <p>住址:6</p>
  <p>生日:7</p>
  <p>郵箱:8</p>
  <p><input type="submit" value="確認(rèn)修改"/> </p>
</form>
</body>
</html>

效果展示:

首頁(稍顯簡陋,可后期修飾):

(登錄還未實(shí)現(xiàn))

 注冊:

填寫信息點(diǎn)擊注冊跳轉(zhuǎn)到數(shù)據(jù)展示頁面(孫悟空已添加):

 點(diǎn)擊修改:(修改zhaosi名字為趙四)

 可以看到趙四修改成功; 

 點(diǎn)擊刪除:(點(diǎn)擊刪除”九點(diǎn)“,刪除成功)

總結(jié)

到此這篇關(guān)于jsp、servlet前后端交互對數(shù)據(jù)處理及展示的簡單實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)jsp、servlet前后端交互數(shù)據(jù)處理內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Spring?boot整合ELK詳細(xì)過程

    Spring?boot整合ELK詳細(xì)過程

    ELK是由Elasticsearch、Logstash和Kibana三個開源軟件組成的技術(shù)堆棧,主要用于數(shù)據(jù)的存儲、處理和可視化,本文給大家介紹Spring?boot整合ELK詳細(xì)過程,感興趣的朋友一起看看吧
    2024-01-01
  • Presto支持Elasticsearch數(shù)據(jù)源配置詳解

    Presto支持Elasticsearch數(shù)據(jù)源配置詳解

    這篇文章主要為大家介紹了Presto支持Elasticsearch數(shù)據(jù)源配置詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-12-12
  • Spring5學(xué)習(xí)之基礎(chǔ)知識總結(jié)

    Spring5學(xué)習(xí)之基礎(chǔ)知識總結(jié)

    這篇文章主要介紹了Spring5學(xué)習(xí)之基礎(chǔ)知識總結(jié),文中有非常詳細(xì)的代碼示例,對正在學(xué)習(xí)java的小伙伴們有非常好的幫助,需要的朋友可以參考下
    2021-05-05
  • Springboot中項(xiàng)目的屬性配置的詳細(xì)介紹

    Springboot中項(xiàng)目的屬性配置的詳細(xì)介紹

    很多時(shí)候需要用到一些配置的信息,這些信息可能在測試環(huán)境和生產(chǎn)環(huán)境下會有不同的配置,本文主要介紹了Springboot中項(xiàng)目的屬性配置的詳細(xì)介紹,感興趣的可以了解一下
    2022-01-01
  • IDEA創(chuàng)建Servlet編寫HelloWorldServlet頁面詳細(xì)教程(圖文并茂)

    IDEA創(chuàng)建Servlet編寫HelloWorldServlet頁面詳細(xì)教程(圖文并茂)

    在學(xué)習(xí)servlet過程中參考的教程是用eclipse完成的,而我在練習(xí)的過程中是使用IDEA的,在創(chuàng)建servlet程序時(shí)遇到了挺多困難,在此記錄一下,這篇文章主要給大家介紹了關(guān)于IDEA創(chuàng)建Servlet編寫HelloWorldServlet頁面詳細(xì)教程的相關(guān)資料,需要的朋友可以參考下
    2023-10-10
  • 使用SpringBoot與EasyExcel實(shí)現(xiàn)復(fù)雜的導(dǎo)入導(dǎo)出

    使用SpringBoot與EasyExcel實(shí)現(xiàn)復(fù)雜的導(dǎo)入導(dǎo)出

    這篇文章主要介紹了使用SpringBoot與EasyExcel實(shí)現(xiàn)復(fù)雜的導(dǎo)入導(dǎo)出,EasyExcel是一個快速解決大文件內(nèi)存溢出的Excel處理工具,它能讓你在不用考慮性能、內(nèi)存等因素的情況下,快速完成Excel的讀、寫等功能,需要的朋友可以參考下
    2023-10-10
  • Java設(shè)計(jì)模式之抽象工廠模式(Abstract?Factory)

    Java設(shè)計(jì)模式之抽象工廠模式(Abstract?Factory)

    這篇文章主要為大家詳細(xì)介紹了Java設(shè)計(jì)模式之抽象工廠模式,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-03-03
  • Spring整合Mybatis方式之注冊映射器

    Spring整合Mybatis方式之注冊映射器

    這篇文章主要介紹了Spring整合Mybatis方式之注冊映射器,MapperFactoryBean注冊映射器的最大問題,就是需要一個個注冊所有的映射器,而實(shí)際上mybatis-spring提供了掃描包下所有映射器接口的方法,每種方式給大家介紹的非常詳細(xì),需要的朋友參考下吧
    2024-03-03
  • SpringBoot中Mybatis + Druid 數(shù)據(jù)訪問的詳細(xì)過程

    SpringBoot中Mybatis + Druid 數(shù)據(jù)訪問的詳細(xì)過程

    Spring Boot 底層都是采用 SpringData 的方式進(jìn)行統(tǒng)一處理各種數(shù)據(jù)庫,SpringData也是Spring中與SpringBoot、SpringCloud 等齊名的知名項(xiàng)目,下面看下SpringBoot Mybatis Druid數(shù)據(jù)訪問的詳細(xì)過程,感興趣的朋友一起看看吧
    2021-11-11
  • Java為什么占用四個字節(jié)你知道嗎

    Java為什么占用四個字節(jié)你知道嗎

    這篇文章主要介紹了Java為什么占四個字節(jié),文中介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-08-08

最新評論