This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund 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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply 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: 160
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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Struts2: Can my action class pick up falses in a collection of checkboxs
 
Similar Threads
set value of a property as another property
dynamic checkboxes in struts 2
Struts2 - <s:iterator> in two-Dimensional Array.
How to reterive table row value (JSP )from the action class
Struts2 Checkbox: How to set value back to Bean