Hi there. I am a relative newbie to struts and I am experiencing problems validating date fields in my forms. The validation is working on String fields (length, mask etc) but the date fields are apparently escaping validation and I get sql errors as the data is rejected by a MySQL database.
I have removed the validate() method from my Action Form, which extends ValidatorForm. My code in validation.xml is as follows:
<field property="tour.endAt"
depends="required,date">
<arg0 key="tourform.endAt"/>
<var>
<var-name>datePatternStrict</var-name>
<var-value>yyyy-MM-dd</var-value>
</var>
</field>
This is a most perplexing problem and any help would be much appreciated.
Cheers
-
Date Validation in Struts (1 messages)
- Posted by: Mike Parker
- Posted on: July 17 2003 15:35 EDT
Threaded Messages (1)
- Struts 2 Date format by Deepak Kumar on June 11 2007 10:47 EDT
-
Struts 2 Date format[ Go to top ]
- Posted by: Deepak Kumar
- Posted on: June 11 2007 10:47 EDT
- in response to Mike Parker
Hi, Learn how to use Struts 2 tags to format date and numbers. Read more at http://www.roseindia.net/struts/struts2/date/struts-2-date-format.shtml Thanks