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.

Reply via email to