My model object has an XMLGregorianCalendar for a birthDate attribute. So I have created a custom converter which takes the string and converts it. Birthdate is also a required field.
My converter is global - I have it listed in the xworks-conversion.properties file
What's happening is that if the user types in a string which is not parseable by the MM/dd/yyyy pattern, the conversion error is thrown (great np there) HOWEVER the "required" validation error is thrown ALSO, so the screen shows up with the invalid message and the required message PLUS the birthDate field is blank.
I thought that ValidationAware was supposed to retain the user's original value? Also, I understand that the model object will not have a populated birthDate because the conversion failed, but is there a way to short-circuit the "required" validation if a conversion error occurs.
P.S I tried adding the following to the action-validation.xml file - in order to save the user's original entry :
However, the value isn't repopulated and now the "invalid" error is shown twice. I also tried adding "short-circuit="true" to the field-validator, but it didn't short-circuit the "required" logic.
Your problem might be because of "ConversionError" Interceptor who raises an Exception and automatically adds "Conversion" error to your field.
Plus, you have got your own "conversion" field validation. Your another problem is that, You have to "short-circuit" your first "required" validator.
There is still lot to learn!
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com