I am trying to validate date, I have the following in validator-rules.xml, but date validation does not work, although I have struts.jar in classPath and it has FieldChecks.class in it. Thank you Garandi
[ March 22, 2005: Message edited by: Garandi Garandi ]
Thank you for your reply, what is "<var-name>datePatternStrict</var-name>",and how am I going to use it. Thank you in advance Garandi
Joined: Feb 15, 2005
In order for the validation framework to validate your date, it must know what format you expect the date to be in. Internally, it uses java.text.SimpleDateFormat to do this. If you look up this class in the Java API, you will find that one of it's constructors requires a format string such as the one given in the <var-value>tag of the example I gave you. The API docs will also show you the list of valid characters in this string. The <var-name> and <var-value> in the validation.xml example simply pass a parameter into the validator.
One other thing: make sure that your struts-config.xml has the following entry:
Otherwise, the validator isn't even turned on.
I'd advise you to open up the struts-examples.war that came with the download and study the example of validation that is there. One example includes a data validation. That should help you to understand how all the pieces fit together.