Hi, Thanks for your response, now I am able to validate Date fields. But still I have 2 more doubts.
1) How to change the Date format? If I enter Date in MM/DD/YYYY in the text field, it is validating but I want the format as DD/MM/YYYY. How do I change the date format? I tried like this but it is not validating <field name="dob"> <field-validator type="date"> <par name="min">31/12/1949</par> <par name="max">01/01/1991</par> <message>DOB must be within ${min} and ${max}</message> </field-validator> <field-validator type="required"> <message>Please enter DOB</message> </field-validator> </field> 2) Comparing 2 fileds not displaying message I am comparing Password and Confirm password field in xml. It is comparing both the fileds but I am not getting the message. <field name="password"> <field-validator type="requiredstring"> <message>Please provide Password</message> </field-validator> <field-validator type="stringlength"> <par name="minLength">1</par> <par name="maxLength">10</par> <message>Password should be min of 1 and max of 10 letters</message> </field-validator> </field> <field name="cpassword"> <field-validator type="requiredstring"> <message>Please confirm your password</message> </field-validator> </field> <validator type="expression"> <par name="expression">password.equals(cpassword)</par> <message>Password entered in both the fileds are not same</message> </validator> Thanks in advance, =============================================================================== newton.dave wrote: > > NR031 wrote: >> 1) How to validate a Date format in Struts 2 >> >> I have my <action-class>-validation.xml like this : >> >> <field name="DOB"> >> <field-validator type="requiredstring"> >> <message>Please enter your Date of birth</message> >> </field-validator> >> <!-- >> Here I have to validate the format >> --> >> </field> > > Perhaps with the date validator: > http://struts.apache.org/2.x/docs/date-validator.html > >> 2) How to compare two fields >> >> I am having password and confirm password fileds. If both the filed >> values >> are not same, I want to display some error message. >> >> <field name="Confirm Password (*)"> >> <field-validator type="requiredstring"> >> <message>Please confirm your password</message> >> </field-validator> >> </field> > > Perhaps with the expression validator: > http://struts.apache.org/2.x/docs/expression-validator.html > > Dave > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > -- View this message in context: http://www.nabble.com/Struts-2-Validation-tp23421029p23440767.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org