Hello homas,
To avoid this problem, I use String type in my getter/setter in my Struts
form for any type (Integer, Date,...).
So, you could do that :

public class User {
   String age;
   public String getAge(){
       return age;
   }
   public void setAge(String age){
      this.age=age;
}
}

After you must convert String age into Integer age in your action struts
(after validation), to get values of  list of ages.
Regards
Angelo

2006/3/27, Thomas Otto <[EMAIL PROTECTED]>:
>
> Hello,
> I have the following problem.
>
> I have an struts form with an Collection getter and want to let set
> struts the input values of an submit.
>
> public class UserForm extends ActionForm {
>   // returns a collection of user beans
>    Collection getUsers(){
>    ...
> }
> }
>
> public class User {
>    Integer age;
>    public Integer getAge(){
>        return age;
>    }
>    public void setAge(Integer age){
>       this.age=age;
> }
> }
>
> In the jsp- Page I use layout:collection with layout:text to show the
> input fields in a table.
> <layout:form action="/save">
>        <layout:collection property="users" indexId="index">
>               <layout:collectionItem title="Age" >
>                        <layout:text property="users[${index}].age"
> layout="false"/>
>               </layout:collectionItem>
>    </layout:collection>
> </layout:form>
>
>
> On submit struts fill also all values in the user bean, but struts set
> "0" into the age-Field and not "null" if the value is empty.
> How can I modify this?
>
> Regards
> Tom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to