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