struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davide Gurgone <dav...@gurgone.it>
Subject Re: newbie question on indexed properties
Date Fri, 09 Jul 2004 14:50:03 GMT
Bill Siggelkow wrote:
> Davide,
> 
> Maybe I am doing something wrong but I have had problems getting indexed 
> =true to work for arrays on the form -- it works correctly for arrays of 
> a nested property of form.
> 
> For example, if I were to use what you suggested I get something like:
>  <br/><input type="text" 
> name="org.apache.struts.taglib.html.BEAN[0].answer" 
> value="[Ljava.lang.String;@487c5f">
> 
>          <br/><input type="text" 
> name="org.apache.struts.taglib.html.BEAN[1].answer" 
> value="[Ljava.lang.String;@487c5f">
> 
>          <br/><input type="text" 
> name="org.apache.struts.taglib.html.BEAN[2].answer" 
> value="[Ljava.lang.String;@487c5f">
> 
> When what I want is:
> 
> <br/><input type="text" name="answer[0]" value="foo">
> 
> <br/><input type="text" name="answer[1]" value="bar">
> 
> <br/><input type="text" name="answer[2]" value="baz">
> 
> I am doing something wrong?
> 
> Davide Gurgone wrote:

I'm sorry, but I understand slowly... What kind of bean r you useing?
I use in this form bean an indexed property named esami

[CUT]
public class AccettazioneForm extends ActionForm {

   //[CUT]
   private String esami[];
   //[CUT]
   public void reset(ActionMapping mapping, HttpServletRequest request) {
     if (page == 0){
       resetFields();
     }
   }
   protected void resetFields(){
     esami = new String[]{};
   }
   public String[] getEsami() {return esami;}
   public void setEsami(String[] value) {esami = value;}

[CUT]
}

<logic:iterate id="e" name="esami">
   <td style="width:30%;">
     <html:text property = "esami"
                indexed  = "true"/></td>
</logic:iterate>

It works fine...


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message