Springmvc + jquery Easyui for paginated display

Source: Internet
Author: User
Tags getdate locale

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 + "/";%&GT;&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" &GT;&LT;/SPAN&GT;: Datetime.getdate (); <span style= " White-space:pre "></span>var hour = datetime.gethours () < 10? "0" + datetime.gethours () <span style= "White-space:pre" &GT;&LT;/SPAN&GT;: 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 package

Package 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.