If you do not understand the place, the play Welcome to join QQ Group Exchange:66728073
One, download and import the jquery Easyui guide
<link rel= "stylesheet" type= "Text/css" href= "<%=basepath%>js/jquery-easyui-1.4/themes/default/easyui.css "><link rel=" stylesheet "type=" Text/css "href=" <%=basepath%>js/jquery-easyui-1.4/themes/icon.css "> <link rel= "stylesheet" type= "Text/css" href= "<%=basepath%>js/jquery-easyui-1.4/themes/color.css" >< Script type= "Text/javascript" src= "<%=basepath%>js/jquery-easyui-1.4/jquery.min.js" ></script>< Script type= "Text/javascript" src= "<%=basepath%>js/jquery-easyui-1.4/locale/easyui-lang-zh-cn.js" ></ Script><script type= "Text/javascript" src= "<%=basepath%>js/jquery-easyui-1.4/jquery.easyui.min.js" ></script>
Second, JSP page
<%@ page language= "java" import= "java.util.*" pageencoding= "utf-8"%><%string path = Request.getcontextpath () ; String basepath = request.getscheme () + "://" + request.getservername () + ":" + request.getserverport () + path + "/";%>&L t;! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" ><span style= "White-space:pre" >//jquery-ui, used to format date date function FormatDate (val, row) {<span Style= "White-space:pre" ></span>var datetime = new Date () <span style= "White-space:pre" ></span> Datetime.settime (val); <span style= "White-space:pre" ></span>var year = Datetime.getfullyear (); <span Style= "White-space:pre" ></span>var month = datetime.getmonth () + 1 < 10? "0" <span style= "White-space:pre" ></span>+ (Datetime.getmonth () + 1): Datetime.getmonth () + 1;<span Style= "White-space:pre" ></span>var date = Datetime.getdate () < 10? "0" + datetime.getdate () <span style= "White-space:pre" ></SPAN>: Datetime.getdate (); <span style= " White-space:pre "></span>var hour = datetime.gethours () < 10? "0" + datetime.gethours () <span style= "White-space:pre" ></SPAN>: Datetime.gethours (); <span style= " White-space:pre "></span>var minute = Datetime.getminutes () < 10? "0"<span style=" White-space:pre "></span>+ datetime.getminutes (): Datetime.getminutes (); <span style=" White-space:pre "></span>var second = Datetime.getseconds () < 10? "0" <span style= "White-space:pre" ></span>+ datetime.getseconds (): Datetime.getseconds (); <span style= "White-space:pre" ></span>return Year + "-" + month + "-" + Date + "" + Hour + ":" + minute<span style= "white- Space:pre "></span>+": "+ second;<span style=" White-space:pre "></span>}</span> </ Script></body>Third, SPRINGMVC background processing/** * get Article * @ Author Guangshuai.wang * 2014-10-14 a.m. 12:10:40 * @param type * @param request * @param nowpage The current page, this is the Jquery-easyui Auto-Submit Energy parameter , the parameter name must be page * @param the number of records displayed per page, this is the Jquery-easyui auto-commit parameter, the parameter name must be rows * @return */@RequestMapping ("/getallblogs/{type } ") @ResponseBodypublic String getallblogs (@PathVariable (" type ") int type,httpservletrequest request, @RequestParam (" Page ") int nowpage, @RequestParam (" Rows ") int rows) {list<blog> blogList = Blogmanager.getallblogbytype (type); Request.setattribute ("BlogList", blogList); int totalblogs = Blogmanager.getallblogcountbytype (type); Pages pages = new pages (totalblogs, nowpage, rows);p ages.seturl ("blog/getallblogs/" + type + "/"); Request.setattribute (" PageInfo ", pages);//return"/jsp/blog/allblog "; Responseresult result = new Responseresult (); Result.settotal (+); result.setrows (blogList); return json.tojsonstring (result);}
Four, I closed myself a return class to return the JSON string for the jquery Easyui packagePackage Com.gametech.entity;public class Responseresult {<span style= "White-space:pre" ></span>// The life of these two members cannot be changed to private int total;private Object rows;public int gettotal () {return total;} public void Settotal (int. total) {this.total = total;} Public Object GetRows () {return rows;} public void Setrows (Object rows) {this.rows = rows;}}
If you do not understand the place, the play Welcome to join QQ Group Exchange:66728073
Springmvc + jquery Easyui for paginated display