Pagination display based on SSH framework, Oracle database, Easyui

Source: Internet
Author: User

Requirements: Complete the Paginaton paging function in Easyui-datagrid.

Configuration of the 1.easyui-datagrig

<table id= "DG" Rownumbers=true fitcolumns= "true" singleselect= "true" data-options= "Pagination:true,fit:true,toolbar: ' #tt '" ><thead><tr><th field= "bNo" align= "center "Width=" 120px "> Teller No. </th><th field=" btype "align=" center "width=" 150px "> Teller type </th><th field=" Jgno "align=" center "width=" 120px "> Organization number </th><th field=" Pzcount "align=" center "width=" 120px "> Voucher number </  th><th field= "Zjcount" align= "center" width= "120px" > Number of main pieces </th><th field= "Fjcount" align= "center" Width= "120px" > Number of Attachments </th><th field= "Sbpass" align= "center" width= "150px" > Identification voucher </th><th field= " Sbsuccess "align=" center "width=" 150px "> Identify success </th><th field=" Sbroute "align=" center "width=" 120px "> Recognition rate </th><th field= "ywdate" align= "center" width= "170px" > Business date </th></tr></thead></ Table> 

The pagination= "true" data table automatically places the page bar below the table, and toolbar= "#tt" indicates that the toolbar is added above the data table, and that the style is determined by the module id= "#tt". Look at the other configurations of the JS file for the DataGrid:

$ (' #dg '). DataGrid ({url: ' user/querylist.action ', pagelist: [5,10,20,50,100], pagesize:5});

The URL refreshes the DataGrid's automatic request for the page, and each request passes two parameters to the background: 1) page, current page, 2) rows, showing several data per page. So in the background need to collect these two important information.

Action Configuration for 2.STRUTS2

Public String querylist () {list<user> List = userservice.querylist (page,rows);p ag1 = new Pagination<user> () ;p ag1.settotal (Userservice.getcount ());p ag1.setrows (list); return SUCCESS;}
<package name= "Work" namespace= "/user" extends= "Json-default,struts-default" ><action name= "QueryList" class= "Useraction" method= "querylist" ><result type= "JSON" ><param name= "root" >pag1</param> </result></action>

PAG1 for DTO data transfer objects with total and rows two properties (JSON format required by the DataGrid)

3.hibernate Tier Service Paging method

Public list<user> querylist (int page, int pageSize) {//TODO auto-generated method stubstring hql = ' from User '; Query query = userdao.getsession (). CreateQuery (HQL); int beginnum = (page-1) *pagesize;int endnum = beginnum+pagesize> GetCount () GetCount ()-beginnum:p agesize; query.setmaxresults (endnum);  Query.setfirstresult (beginnum);  return Query.list ();}



Pagination display based on SSH framework, Oracle database, Easyui

Related Article

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: 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.