aspose file tools*
The moose likes Struts and the fly likes Problem with iterator for checkboxes. How to set value to bean property? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with iterator for checkboxes. How to set value to bean property?" Watch "Problem with iterator for checkboxes. How to set value to bean property?" New topic
Author

Problem with iterator for checkboxes. How to set value to bean property?

Michael Freake
Greenhorn

Joined: Jun 03, 2009
Posts: 24
Hi,

I'm trying to display a list of checkboxes that will represent a list of clients. Each of my checkboxes has a name="id". They also have a value="on". I'd like the value to be the actual user IDs instead of "on". (ie. user.getId()) My desired HTML output is below. I could then just iterate over the values picking up and processing the client IDs:



My problem is how do I get the client IDs in the value field? Here is my current output below along with the code I'm using to generate it:



Current Code:


And here is my ActionForm incase it is needed:



Thanks for any help. I'm starting to think maybe I'm approaching this the wrong way...
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Use EL and put ${client.id} in the value attribute?
Michael Freake
Greenhorn

Joined: Jun 03, 2009
Posts: 24
Hi David,

Thanks for the suggest, but I ended up using a different approach. Updated my UploadForm with get and set methods that used a String array of Client names (not quite as useful as ids), and used a html:multibox to display correctly.

It works fine for my small app.

Thanks again.
 
Consider Paul's rocket mass heater.
 
subject: Problem with iterator for checkboxes. How to set value to bean property?
 
Similar Threads
Struts Validation Empty alert Box
struts file upload problem
File Uplaoding problem needs help
Problem in SessionManagement in Struts
Client side validation not working