How to validate date in struts
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Kunniyur_Biju
Posted On:   Monday, April 26, 2004 07:46 PM

hi,
I want to validate date in struts.The scenario is like this .I am using a date field in my jsp and with respect to that i set a variable in form bean as Date.but when i submit the form after entering the date it gives the following exception

java.lang.IllegalArgumentException: argument type mismatch.
can anybody suggest how to validate date in struts

Re: How to validate date in struts

Posted By:   Eric_Lemle  
Posted On:   Friday, June 18, 2004 10:59 AM




date
[0-1]?[0-9]/[0-3]?[0-9]/[0-9][0-9][0-9][0-9]


number
[0-9]*

Re: How to validate date in struts

Posted By:   Eric_Lemle  
Posted On:   Friday, June 18, 2004 10:45 AM

You need to put the code in the validate() method of a

ValidateActionForm subclass. Or you need to use the built

in XML validation of STRUTS which is way too much to
explain in this reply. Look it up.



All forms and the beans use Strings so I don't think you
can have a Date type in the .jsp, but you could validate

it on the client side with javascript also.

Hope that helps.
About | Sitemap | Contact