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 Usage of html:checkbox for Multiple Entities 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 "Usage of html:checkbox for Multiple Entities" Watch "Usage of html:checkbox for Multiple Entities" New topic
Author

Usage of html:checkbox for Multiple Entities

sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
Hi

I have a scenario in which there are multiple checkboxes in the same page belonging to one logical entity(Say Hobbies with multiple options given to choose in the form of Checkbox Group).

Now in my ActionForm(Bean)i am using one get and set method with String[] as dataType.

So when the user selects multiple hobbies and clicks Submit, values gets filled properly . But during the modification scenario (like i set the hobbies to the form bean), the appropriate hobbies are not getting selected automatically though i used html:checkbox tag.

Is it that checkbox tag is not handling for Array of Values ??
Tim Storms
Ranch Hand

Joined: Apr 27, 2006
Posts: 64
You need to use the html:multibox tag.

For example:


You can now catch all the values in a String array in your form bean.

You also wanna check Struts Multibox Tag
[ June 30, 2006: Message edited by: Tim Storms ]

SCJP 1.5, SCWCD 1.4, SCBCD 5
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Usage of html:checkbox for Multiple Entities
 
Similar Threads
Usage of html:checkbox for Multiple Entities
how to use- html:checkbox - and iterate it through - logic:iterate
Getting the checkbox collection values in the FormBean
How to enable checkbox from value fetched from database
html:mutlibox uncheck ,check problem