struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Siggelkow <bills...@bellsouth.net>
Subject Re: newbie question on indexed properties
Date Fri, 09 Jul 2004 15:13:48 GMT
Okay -- now I am confused -- if I use your approach I get ...

javax.servlet.ServletException: Cannot find bean esami in any scope

I have to specify the name of the form as the value for the 'name' 
atrribute of logic:iterate

Davide Gurgone wrote:

> 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