Author Login
Post Reply
Hi,
I wrote I type converter that convert a Date into a String:
...
public Object convertFromString(Map context, String[] values, Class
toClass)
{
if (values != null && values.length > 0 && values[0] != null &&
values[0].length() > 0) {
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");
try {
return sdf.parse(values[0]);
} catch (ParseException e) {
throw new TypeConversionException(e);
}
}
return null;
}
...
If the type conversion fails the convert()-method returns a null value.
After the type conversation I validate the field and check that this is not
null. So if the field value is "dfasde3" I get a type converion error and a
null validation error thrown by the Validation framework. So on view site I
have two error messages.
How can I prevent, that the validation for the field is also executed when
the conversion failed?
Thanks
Canny Duck
--
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)