Hello Vijay,
an add convertNull with true to the web.xml solves the problem.
Thank you,
Tom
vijay venkataraman schrieb:
In case you missed to see this in the docs... See the Struts doc:
Building View Components and See in Struts Validator.
Note: If your required form property is one of the Java object
representations of primitive types (ie. java.lang.Integer), you must
set the ActionServlet's *convertNull* init parameter to true. Failing
to do this will result in the required validation not being performed
on that field because it will default to zero
Thanks,
Vijay Venkataraman
Angelo zerr wrote:
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]
------------------------------DISCLAIMER------------------------------
This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error, please immediately delete it and
all copies of it from your system, destroy any hard copies of it and
notify the sender. You must not, directly or indirectly, use,
disclose, distribute, print, or copy any part of this message if you
are not the intended recipient.
Lisle Technology Partners Pvt. Ltd. and any of its subsidiaries each
reserve the right to monitor all e-mail communications through its
networks.
Any views expressed in this message are those of the individual
sender, except where the message states otherwise and the sender is
authorized to state them to be the views of any such entity.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]