This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts2: Can my action class pick up falses in a collection of checkboxs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2: Can my action class pick up falses in a collection of checkboxs" Watch "Struts2: Can my action class pick up falses in a collection of checkboxs" New topic
Author

Struts2: Can my action class pick up falses in a collection of checkboxs

David Rocks
Ranch Hand

Joined: Apr 24, 2001
Posts: 162
Hi,

I have a colleciton of objects displayed in a table using an iterator, on the end of each row I have a checkbox where you can select each row

<s:iterator ..... id="row" >
...
... <s: name="selected" value="row.id" >
...
<s:iterator>

I happiily pick up the trues in my action class with this attribute and associated getters and setters..

private Long[] selected ;

The array holds as many trues as selected but really I would like it to hold as many as there are checkboxes displayed and the falses are somehow tagged as such.

Can this be done? The alternative is hidden form attributes which could possibly be insecure.

Thanks in advance.


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The <s:checkbox...> tag creates a hidden field for un-checked checkboxes already.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2: Can my action class pick up falses in a collection of checkboxs
 
Similar Threads
dynamic checkboxes in struts 2
How to reterive table row value (JSP )from the action class
Struts2 - <s:iterator> in two-Dimensional Array.
Struts2 Checkbox: How to set value back to Bean
set value of a property as another property