struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Kindler <li...@kruescho.de>
Subject type conversion versus validation
Date Tue, 31 Mar 2009 12:03:32 GMT
Hi there,

when using domain objects in a struts action I'm facing the problem that 
type conversion throws an error before validation is executed when 
having non string properties.

Example:
in my action I have a property organization which has itself a property 
contact. The contact object has a zipcode property which is accessed in 
the view via organization.contact.zipcode. Because in germany a zipcode 
is 5 digit integer, the zipcode property in the contact class is an int. 
When a user inserts a non integer in the zipcode field, the type 
conversion complains before validation can match.

What is the best practice in such a case? I will not rely on client side 
validation.

Regards
Christian


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


Mime
View raw message