Thanks Rick for the response. Here is what I'm trying to do: I get the top level list from the backend. The list contains the other lists that I already described before. Apart from that it contains the information based on which I have to generate the UI. That is, my UI might look like this:
------------------------------------------- GROUP-1: ITEM-11 . component111 . component112 . component113 ITEM-12 = component121 = component122 = component123 GROUP-2: ... ... -------------------------------------------- The back-end might specify that I need to use radio buttons for components under ITEM-11 and use checkboxes for ITEM-12. I can use the ids for value of radio buttons instead of trying to set a boolean as you said. But I'm not sure how I can do this. Thanks, Kalyan -----Original Message----- From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 10, 2005 11:00 AM To: Struts Users Mailing List Subject: Re: Radio button for a 3rd level list Kalyan Ayyagari wrote the following on 5/10/2005 10:47 AM: > > public class Component{ > int id; > > boolean amISelected; } > > My JSP needs to have a radio button for each component. For example, say > level3List has 3 components, red, green and blue. Then the JSP will have 3 > radio buttons, one for red, one for green and one for blue. Now let's say > that we have only clicked the radio button for red. Now when we submit the > form I want the boolean amIselected for red to be true; and false for green > and blue. Well, this can be a little tricky or really simple. The first thing I need to ask is "What is your business requirement that you are actually trying to tackle?" The reason I ask this is, before I get into how you can do what you want, their could possibly be a much cleaner solution. For example, if you want the user to "select" between three components, even if selecting between multiple sets of three components (red, green, blue). Why not provide radio buttons but for the value simply provide the unique componentID for the value ? Then when the form submits you have the 'id's of the components the user selected? I think this would be a much cleaner solution, however sometimes you do need to do something like you are describing, so there are ways. The tricky part is that name of each radio button would be different based on the fact that you are wanting to modify a property of bean in the form (not a simple boolean property directly in the form). I think you would have to use javascript here. I'd probably go with a checkbox for each and although the names would be different for the checkbox, you could give them all a similar id based on your iteration. Then when one is checked you'd pass in the id of that checkbox and your javascript function would know how to turn off the other ones. Again, first step is figuring out what exactly you need to capture, because my guess is you don't have to go this route. -- Rick --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]