Struts page issues simple solution

xiaoxiao2021-04-05  261

ARRAYLIST LIST that acquires data in the corresponding ActionForm;

Request.setttribute ("Data_Length", New Integer (list.size ());

Set this data length is to know how to display a few pages

Then add the following code at the JSP page responsible for the display:

<% String url = "Employeelist.do?pagenumber="; int length = ("Data_Length")). INTVALUE (); // Get total data bar number int PageSize = 10; // Page 4 Data INT Pages = (Length - 1) / PageSize 1; // Calculate page number int off = 0; // Data start index int Pagenumber = 1; // Current page number if (Request.GetParameter) ("Pagenumber")! = NULL) PAGENUMBER = (New Integer)))))))). IntValue (); offset = (Pagenumber - 1) * Pagesize;%>

Then add the paging code:

Page 1 <% for (int i = 2; i page <%}%> Last page

The above cycle I want to replace with Struts's logo library function, because I just get in touch with Struts, I am not familiar, so I can only temporarily solve my problem. I will find ways to optimize it. If you have any opinions, you can also write it.

转载请注明原文地址:https://www.9cbs.com/read-132198.html

New Post(0)