I am using Struts2 validation in a web form. In the case where the field is considered an integer or Date, the message <s:fielderror> that I receive is a common Invalid field value for field "[fieldname]" Naturally, I want to configure it for the user.
Here is a validation example:
<field name="spouseDOB"> <field-validator type="date"> <message>"Spouse Date of Birth" is invalid.</message> </field-validator> <field-validator type="date"> <param name="min">01/01/1900</param> <message>"Spouse Date of Birth" must be after 1900 AD.</message> </field-validator> </field>
The message "Spouse Date of Birth" is invalid. never appears for any incorrect date I tried. The output is a common Invalid field value for field spouseDOB
spouseDOB is the java.util.Date object in the action class. It is set to <s:textfield> in the JSP.
source share