Up to ValidatorFAQ

Do most people allow users to type in a complete free-form text date? Or do you give them three boxes where they must put in month day and year separately?

I'm trying to come to terms with validation. I can't turn on the automatic validation <action validate="true" ... > because the users are allowed to leave the form before it's complete and come back to it. Will I still be able to use the plug-in Validator? (All the actions in the struts-validator example have 'validate' this turned on.

But here's where I get lost. In order to copy the properties back and forth from Value Object to ActionForm, the types have to match. (Don't they?) But if I put a java.sql.Date into my ActionForm, then it will blow up when the user types 7/13/1985 rather than 1985-07-13 and submits the form.

So, I need a String property in the ActionForm, and ... some special something that turns it into a java.sql.Date but will not blow up if the input is wrong?


we use this http://developer.iplanet.com/viewsource/husted_calendar/husted_calendar.html

-Tim Cronin

Also Commons BeanUtils provides a number of automatic conversions, so this might be performed already.

Rob Leland

Up to ValidatorFAQ

  • No labels