All suggestions are welcome Eddie. Your idea and your argumentations are good, but your proposed solution doesn't work :-(
Explanations : In a taglib property you can use either a string value or a RunTime Expression (if allowed in the TLD). If you use a string you have something like : property="all I want to write" If you use a RT Expr you have something like : property="<%=java expression%>" The tag libraries interpreter verify if the content of the property begins with <%= and ends with %> . In this case it suppose that it is a RT Expr and values it. In all other case it supposes that the content is a string. With your suggestion, property="myRadios[<%= index %>]" the tag libraries interpretor see that there's not <%= at the begining and %> at the end. Then it passes the value "myRadios[<%= index %>]" as a string to the taglib. When the taglib get the content of property, it will analize it and see that it is a indexed property because of [..] but won't be able to interpret it and will launch an exception like : java.lang.IllegalArgumentException: Invalid indexed property 'myRadios[<%=index%>]' However, it is important to say that your advice is totally good if you want to use a dynamic value in standard html tag. I you have another idea to clean my code, don't hesitate to propose it. Arnaud. > -----Message d'origine----- > De : Eddie Bush [mailto:[EMAIL PROTECTED]] > Envoye : mardi 16 juillet 2002 17:54 > A : Struts Users Mailing List > Objet : Re: Indexed Properties - soluce :-) > > > May I make a suggestion? You're causing the implicit > creation of many > strings ... and doing it in a loop (bad). Try this: > > <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> > > This way, you don't have the implicit string creation (you > get one every > time you use the + to concatenate). Object creation is slow :-( so > don't do it if you don't have to. > > Regards, > > Eddie > > Arnaud HERITIER wrote: > > >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 > > > > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> >