I create a form in which the user logs in to the struts2 application. The user will have to enter the date in a specific format.
Since I will not use the ajax datepicker tag, I use a text box with a date tag in a form similar to this:
<s:date name="birthDate" id="bDateId" format="yyyy-MM-dd"/>
<s:textfield name="birthDate" id="%{bDateId}" label="Birth Date (yyyy-MM-dd)"/>
The main user object has a String field to represent the date. So my question is that there is a straighforward method to apply validation regarding user input format for date field. The date validator provided by struts2 can be used to check only date ranges, but not for specific formats.
Can someone recommend a way to do this or not point to an example of a custom validator?
Thank you for your advice. Respectfully to all.
source
share