I am new to Struts.I want to iterate over the Hashmap and save its "key" in the radio button as:
Here AddressMap is the HashMap. What should I give the value to the "value" attribute of the radio button so that I can have the "key" of HashMap i.e AddressMap or should I use <html:radio> tag. Could anyone please help me out?
Just a couple of notes: It's best to use the <html:radio> tag because it will show the correct button as selected if you have pre-selected values. Also, providing a body for the <html:radio> tag is the same as specifying a value attribute. Also, it's not a good idea to specify the same name for both the name and id attribute of a <logic:iterate> tag. [ June 24, 2008: Message edited by: Merrill Higginson ]
Thanks Merril for the solution. But I am getting an error in jsp saying that "value" attribute is required. Please help me out, I need it urgently.
Joined: Feb 15, 2005
What I told you about the body substituting for a value attribute is correct for most other Struts html tags, but apparently not for html:radio. Sorry about that. Fortunately, though, html:radio has an idName attribute that can be used to get a bean exposed by a logic:iterate tag. Example:
[ June 25, 2008: Message edited by: Merrill Higginson ]