aspose file tools*
The moose likes Struts and the fly likes Very Urgent : Fututre Date validation using struts validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Very Urgent : Fututre Date validation using struts validation" Watch "Very Urgent : Fututre Date validation using struts validation" New topic
Author

Very Urgent : Fututre Date validation using struts validation

Vidya Mohandas
Greenhorn

Joined: Apr 20, 2004
Posts: 3
I am unable to validate a date field, to not have a future date (the date shud not accept even tomorrows date i.e., it shud not be greater than today's date).
I am using struts validator. Can I do the above mentioned validation using struts validator or I need to have a separate java class for doing the validation (fyi...i shud not use the form bean for any sort of validation)?

Please help me.


vidhya M.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If you want to use the validation framework for this, you're going to have to create your own validation rule. Here is a link that shows an example of how to do this:

http://www.onjava.com/pub/a/onjava/2002/12/11/jakartastruts.html?page=1

If you don't want to go to the trouble of creating a custom validation rule, an easier alternative would be to override the validate() method in your ActionForm and have it do the validation instead of the validation framework.


Merrill
Consultant, Sima Solutions
Srilakshmi Vara
Ranch Hand

Joined: Jul 21, 2004
Posts: 169
Hi,

I think the best way is to override validate method in ActionForm because you can customize it according to your functionality.

Regards,
Srilakshmi
Marco Vanoli
Ranch Hand

Joined: Jan 12, 2005
Posts: 99
It is possible to use validator framework and at the same time override validate() method for that thing not supported from the framework?


bye, <br />Marco
Cendy Nguvy
Ranch Hand

Joined: May 25, 2005
Posts: 37
Hi,

Yes, it's possible.
Code this following in your ActionForm :


[ July 23, 2005: Message edited by: Cendy Nguvy ]
Ganesh Venkat
Greenhorn

Joined: Jul 19, 2005
Posts: 2
Do as Merrill Higginson suggested, in that way you will all the validation rules under the Validator framework,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Very Urgent : Fututre Date validation using struts validation