struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Lindholm <greg.lindh...@gmail.com>
Subject Re: s:textfield and date format as dd/MM/yyyy
Date Wed, 04 Nov 2009 16:29:10 GMT
<field-validator type="regex">
>
> (((((((0[13578])|(1[02]))[\/]((0[1-9])|([12]\d)|(3[01])))|(((0[469])|(11))[\/]?((0[1-9])|([12]\d)|(30)))|((0?2)[\/]((0[1-9])|(1\d)|(2[0-8]))))[\/](((19)|([1-9][0-9]))([\d][\d]))))|((0?2)[\/](29)[\/](((19)|([1-9][0-9]))(([02468][048])|([13579][26])))))$
> </field-validator>
>
>
>
IMHO this is unreadable and unmaintainable and should never be used (even if
it does work).

You would be better off changing your 'date' property to be a String and
handle validation in a validate() method using a DateFormat object.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message