You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by da...@adw.es on 2008/11/14 20:38:42 UTC

Radio button default checked with Indexed properties

Hi, 

How can I get a radio button checked by default using indexed properties?

I read in forums to do it in the reset method of the ActionForm, but dont know exactly how to do it...
In my jsp I render X radio buttons,  where X is the number of questions saved in the request Bean "choices" in My action class, I dont render them as separated radio buttons, here the code:

<logic:iterate id="choice" name="choices" scope="request" >
   <html:radio property="control" idName="choice" value="value"/>
   <bean:write name="choice" property="label"/>  ------> (X radio buttons)
</logic:iterate>

In the action form I only have get and set methods for variable control:
getControl(), setControl()....

Everything workd fine, but need to get the radio checked by default to avoid a java error/exception if the user clicks the form
Which code or what should I do?

Thanks in advance guys ;)