aspose file tools*
The moose likes Struts and the fly likes How to retain checkbox value during pagination in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to retain checkbox value during pagination in struts " Watch "How to retain checkbox value during pagination in struts " New topic
Author

How to retain checkbox value during pagination in struts

Matheus Goncalves
Greenhorn

Joined: Oct 19, 2012
Posts: 1

Hi there, I'm stuck for 2 days trying to load a checkbox value, from the Action Form.

I need to delete all the selected items from an ArrayList<Person>, so I iterate this list, and put a checkbox before each item.
But when I click the button to delete the selected items, the Action Form reads the ArrayList, but the checkbox field is still empty. I'm clueless and I appreciate any help.

Here is the code:

The Checkbox:



The full code:



That's the verification I'm trying to do:



Here is the ValidateUserListAction :



The class Person is huge, but it has:



Here is the ValidateUserListForm :



And that's the code for struts-config.xml



What I am missing?
Thanks!
Pablo Abbate
Ranch Hand

Joined: Aug 06, 2012
Posts: 30

It has been a lot of time since I worked with the UI. But I remember a few things ...

If you wan't to hold the state of the checkboxes, when you paginate, you need to submit the values. (form)
Another way to do it, is an ajax method while you select an individual checkbox
If you unselect a check, the value doesn't go to the server, so I remember I needed to add a hidden tag with value=false.

Hope it helps.


Nissi Group, Posicionamiento Web, Desarrollo de Software, DiseƱo Web
Blog , LinkedIn
 
Consider Paul's rocket mass heater.
 
subject: How to retain checkbox value during pagination in struts