I am using Struts 2, JSP and JPA in my project.
I have nearly 50 checkboxes in a single page. If i want to get the value of each checkbox in Action class, then i have write 50 getters and setters.
Is there any easy way to get the values of all checkboxes in Action class.
Thank you,
If the checkboxes all have the same name, you can have a getter/setter for a String[].
So, you have this in the jsp:
In your action, you’d have the following:
Similar SO question: How can i get checkbox values from struts2 checkbox in displaytag to action class