struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Strachan, Paul" <>
Subject RE: Date validation
Date Wed, 22 Nov 2006 13:21:43 GMT
what exact value did you enter with the date pattern MM/dd/yy?
I dont like datePatternStrict because you have to enter the leading zero for dd and MM; and
the year should format according to java.text.SimpleDateFormat rules.
I use dd/MM/yyyy (not strict) and the user can type the full year. I usually accompany "date"
with my own custom date validators to ensure the date entered is in a valid range (eg >=
today, between today-80 and today+20)
While day and month are always meaningful, year could be almost anything...if user types "2"
should that be 1902, 2002 or even 2012 or 1992 ?
Although you could write a custom validator and try to handle 2 /4 digit years - you still
have to work out the "real" year; which is a combination of 
1. what year did the user intend?
2. what year does my application expect/want?
1. use the yyyy pattern
2. use extra validation
Good Luck


From: vacak []
Sent: Wed 22/11/2006 9:40 PM
Subject: Date validation


  I use Validator 1.0 and I would like to validate date fields with the
format MM/dd/yy but it works only with the format: MM/dd/yyyy.
In the validation.xml i use this:

         <form name="entryPageForm">
            <field property="reqinitialdate"
                <arg0 key="entryPageForm.reqinitialdate.displayname"/>

So i changed the <var-value> to the format i need but it still doesn't work.
What could be the problem? And what shall i do if i want to accept the both
format? (MM/dd/yy and MM/dd/yyyy)


View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message