Ok I found myself a solution (it seems) :

I need to modify the JSP page to index manually the property and I don't
need to use the indexed="true" which indexes the BEAN and not the property :
<html:form ...>
<logic:iterate id="theRadio" indexId="index" name="myFormBean"
property="myRadios">
<html:radio property="<%=\"myRadios[\"+index+\"]\"%>" value="A"/><html:radio
property="<%=\"myRadios[\"+index+\"]\"%>" value="B"/>
</logic:iterate>
</html:form>

Arnaud

> -----Message d'origine-----
> De : Arnaud HERITIER [mailto:[EMAIL PROTECTED]]
> Envoy� : mardi 16 juillet 2002 15:50
> � : Struts Users Mailing List (E-mail)
> Objet : Indexed Properties
>
>
> Hi guys.
>
> I'm trying to use the Indexed properties of Struts 1.1.
>
> What I understood about indexedProperties is that it allows
> to have a set of
> properties (in a form bean) represented by an array of Strings.
>
> What I want to do is quite simple.
>
> I have a form with a dynamic list of radio buttons groups.
>
> in HTML it is something like this :
>
> <form ...>
> <input type="radio" name="myRadios1" value="A"><input type="radio"
> name="myRadios1" value="B" checked="checked">
> <input type="radio" name="myRadios2" value="A"
> checked="checked"><input
> type="radio" name="myRadios2" value="B">
> ....
> <input type="radio" name="myRadiosN" value="A"
> checked="checked"><input
> type="radio" name="myRadiosN" value="B">
> </form>
>
> in Java with Struts I wrote a FormBean (class MyFormBean)
> with a property
> using an array of strings : String[] myRadios (with getter and setter)
>
> in the JSP :
>
> <html:form ...>
> <logic:iterate id="theRadio" name="myFormBean" property="myRadios">
> <html:radio property="myRadios" indexed="true" value="A"/><html:radio
> property="myRadios" indexed="true" value="B"/>
> </logic:iterate>
> </html:form>
>
> If I initialize the property myRadios of my formbean with the
> following
> Array : String[] myRadios = {"A","A","B","A"};
> the JSP generates the good numbers of radio items like this :
>
> <form ...>
> <input type="radio" name="myRadios1" value="A"><input type="radio"
> name="myRadios1" value="B">
> <input type="radio" name="myRadios2" value="A"><input type="radio"
> name="myRadios2" value="B">
> <input type="radio" name="myRadios3" value="A"><input type="radio"
> name="myRadios3" value="B">
> <input type="radio" name="myRadios4" value="A"><input type="radio"
> name="myRadios4" value="B">
> </form>
>
> but the problem is that this radios aren't initialized with
> the good checked
> properties.
>
> What I'm waiting for is somethink like :
>
> <form ...>
> <input type="radio" name="myRadios1" value="A"
> checked="checked"><input
> type="radio" name="myRadios1" value="B">
> <input type="radio" name="myRadios2" value="A"
> checked="checked"><input
> type="radio" name="myRadios2" value="B">
> <input type="radio" name="myRadios3" value="A"><input type="radio"
> name="myRadios3" value="B" checked="checked">
> <input type="radio" name="myRadios4" value="A"
> checked="checked"><input
> type="radio" name="myRadios4" value="B">
> </form>
>
> I don't understand what happens ??
>
> Can you help me please.
>
> Thx.
>
>   Arnaud HERITIER
>   EAI Consulting
>   Sopra Group
>   T�l. : +33 (0)1 53 33 44 74
>   email : [EMAIL PROTECTED]
>
>   Ce message est exclusivement destin� aux personnes dont le
> nom figure
> ci-dessus. Il peut contenir des informations confidentielles dont la
> divulgation est � ce titre rigoureusement interdite. Dans
> l'hypoth�se o�
> vous avez re�u ce message par erreur, merci de le renvoyer � l'adresse
> e-mail ci-dessus et de d�truire toute copie.
>
>   This message may contain confidential and proprietary
> material for the
> sole use of the intended recipient. Any review or
> distribution by others is
> strictly prohibited. If you are not the intended recipient,
> please contact
> the sender and delete all copies.
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to