I am using the Spring Hibernate Struts framework: This is my DAO core code import org.springframework.orm.hibernate.support.hibernatedaosupport; // Hibernate method supported by Spring, allowing Hibernate to continue slimming PUBLIC List getOfficeBySearchCriteria (final String hsql, final int pageNo, final int page_size) throws DataAccessException // hsql is like: "select office1 from Office as office1 order by office1.officename"; pageNo is the first few pages; page_size is the number of records per page { String sql; int total_count = 0; list offices = new arraylist (); // offices = gethibernateTemplate (). Find ("from office office1 where office1.officename like?", "%" Officename "%"); offices = . getHibernateTemplate () find (hsql); // to obtain the total number of records total_count = offices.size (); crossPageInfo = crossPageBean.getCrossPageInfo (total_count, pageNo, page_size); sql = hsql "limit" (pageNo-1) * Page_size "," page_size; offices = gethibernateTemplate (). Find (sql); // To get page log information system.out.println ("The List offices size:" offices.size ()); return offices; } // where crosspageBean.getcrossPageInfo is just a page, the total number of pages, how many pages of information, etc. General flipping information; I am thased in Action With: public ActionForward execute (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {CrossPageInfo crossPageInfo = new CrossPageInfo (); String hsql = "select office1 from Office office1 order by office1.officename"; String pageNo = request .GetParameter ("Pageno"); INT PAGENOI = 1; IF (Pageno == Null) Pageno = "1"; Pagenoi = Integer.Parseint (Pageno); int pagesize = 5; // list offalth = getOffeService (). getAlloffice (); List offices =
getOfficeService () getOfficeBySearchCriteria (hsql, pageNoi, pageSize); crossPageInfo = getOfficeService () getCrossPageInfo (); System.out.println ( "The CorssPgaeInfo:" crossPageInfo.getPageNo ());.. System.out.println (crossPageInfo. getPageSize ()); request.setAttribute ( "offices", offices); request.setAttribute ( "pageInfo", crossPageInfo); return mapping.findForward ( "success"); // throw new UnsupportedOperationException ( "Generated method 'execute (. ..) 'not implement. ");} // where getOfficeService () just provides a method of providing an interface service.
My performance page is like this: <% @ Taglib URI = "/ Web-inf / struts-bean.tld" prefix = "bean"%> <% @ Taglib URI = "/ Web-inf / struts-html.tld "prefix =" html "%> <% @ Taglib URI =" / Web-inf / struts-logic.tld "prefix =" logic "%> <% @ Taglib URI =" / Web-inf / struts-template.tld "prefix =" template "%> <% @ page import =" com.uplus.util.crosspageInfo "%>