Display and read by PAGE

Source: Internet
Author: User

Java code
Public ActionForward execute (ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
Throws Exception {
Mylog.log.info ("queryAll ");

Int currentPage = 1; // current page
Int lineSize = 8; // number of records per display
Int allRecorders = 0; // total number of pages
String keyWord = null; // keyWord used for search
Try {
KeyWord = request. getParameter ("kw"); // obtain the search keyWord
CurrentPage = Integer. parseInt (request. getParameter ("cp"); // obtain the current page
} Catch (Exception e ){
List <Question> ques = null;
Ques = this. iquestiondao. queryAll (currentPage, lineSize); // obtain the record
AllRecorders = this. iquestiondao. queryAllCount (); // obtain the total number of pages
Request. setAttribute ("all", ques );
Request. setAttribute ("currentPage", currentPage );
Request. setAttribute ("lineSize", lineSize );
Request. setAttribute ("allRecorders", allRecorders );
Request. setAttribute ("jspUrl", "show. do"); // The execution address.
Request. setAttribute ("status ","");
Request. setAttribute ("keyWord", keyWord );
Return mapping. findForward ("showquestion ");
Html code
<Td width = "100px"> title </td>
<Td> reward </td>
<Td> questioner </td>
<Td> browsing Times </td>
<Logic: iterate id = "ques" name = "all">
<Td >$ {ques. title} </td>
<Td >$ {ques. offerscore} </td>
<Td >$ {ques. userid} </td>
<Td >$ {ques. clickcount} </td>
</Logic: iterate>
<Logic: present name = "all" scope = "request">
<Jsp: include page = "split_page.jsp">
<Jsp: param name = "jspUrl" value = "$ {jspUrl}"/>
<Jsp: param name = "lineSize" value = "$ {lineSize}"/>
<Jsp: param name = "allRecorders" value = "$ {allRecorders}"/>
<Jsp: param name = "currentPage" value = "$ {currentPage}"/>
<Jsp: param name = "status" value = "$ {status}"/>
<Jsp: param name = "keyWord" value = "$ {keyWord}"/>
<Jsp: param name = "searchFlag" value = "T"/>
</Jsp: include>
</Logic: present>


Author "A +"

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.