Demo简介
Demo使用Java、Servlet为后台代码(数据库已添加数据),前端使用EasyUI框架,后台直接返回JSON数据给页面
1.配置Web.xml文件
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> <display-name>easyui_pagination_demo</display-name> <welcome-file-list> <welcome-file>backend.jsp</welcome-file> </welcome-file-list> <!-- 前端分页Servlet --> <servlet> <servlet-name>studentServletFront</servlet-name> <servlet-class>com.servlets.StudentServletFrontEnd</servlet-class> </servlet> <servlet-mapping> <servlet-name>studentServletFront</servlet-name> <url-pattern>/stuDatagridDataFront.do</url-pattern> </servlet-mapping> <!-- 后端分页Servlet --> <servlet> <servlet-name>studentServletBack</servlet-name> <servlet-class>com.servlets.StudentServletBackEnd</servlet-class> </servlet> <servlet-mapping> <servlet-name>studentServletBack</servlet-name> <url-pattern>/stuDatagridDataBack.do</url-pattern> </servlet-mapping> </web-app>
2.创建实体类Student
package com.models; /** * 学生类 * * @author yyx 2019年1月8日 */ public class Student { private String stuId; private String stuSno; private String stuName; private Integer stuSex; private Integer stuAge; private String stuEmail; private String stuQQ; private String stuAddress; public String getStuId() { return stuId; } public void setStuId(String stuId) { this.stuId = stuId; } public String getStuSno() { return stuSno; } public void setStuSno(String stuSno) { this.stuSno = stuSno; } public String getStuName() { return stuName; } public void setStuName(String stuName) { this.stuName = stuName; } public Integer getStuSex() { return stuSex; } public void setStuSex(Integer stuSex) { this.stuSex = stuSex; } public Integer getStuAge() { return stuAge; } public void setStuAge(Integer stuAge) { this.stuAge = stuAge; } public String getStuEmail() { return stuEmail; } public void setStuEmail(String stuEmail) { this.stuEmail = stuEmail; } public String getStuQQ() { return stuQQ; } public void setStuQQ(String stuQQ) { this.stuQQ = stuQQ; } public String getStuAddress() { return stuAddress; } public void setStuAddress(String stuAddress) { this.stuAddress = stuAddress; } }