Tutorial :Implementing dynamic pagesize in pagination struts2 + java


I am trying to implement pagination through display tag in Struts2. Now my requirement is I have a combo box which has some page size value like 5, 10, 15 ..

So, How can I update that value in page size of display tag in Struts2 ?


You would create an exposed property on your action, named for example selectedPageSize. This property could be set to a default size (in your example 5). You would keep a hidden form field storing the currently selected value. This would then be used in your view with the display tag similar to:

<c:set name="selectedPageSize" value="selectedPageSize" scope="request"/>  <display:table pagesize="${selectedPageSize}" ... >  


I'm not sure about struts2 in particular, but with JSF in general, if you bind whatever component you use to paginate into your backing bean, you can set properties such as that through an action.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »