| Author |
Struts 2 - Client Side Validation - Date validation - Dynamic min max date
|
Santhosh Kalisamy
Ranch Hand
Joined: Apr 15, 2008
Posts: 55
|
|
Friends,
In my application, we do retrieving a date from a JSP page.
code sniper for JSP:
InitialSwitchAction--Validation.xml
The effective Date field should be within 1 year before today and 1 year after today.
How do I define that dynamic value on "min" and "max" ?
Please help me. I want to check the possibility before I override validate() method to do that validation?!
|
 |
nir sharma
Ranch Hand
Joined: Sep 11, 2012
Posts: 72
|
|
and you need to create getter and setter for minDate and maxDate in your corresponding action class, and assign the values using system date.
|
 |
Santhosh Kalisamy
Ranch Hand
Joined: Apr 15, 2008
Posts: 55
|
|
Thanks Nir Sharma, It is a nice idea.
I have implemented this with slightly different idea. Created a custom Date Validator and fixed this with on validation side itself.
validators.xml
<actionclassname>-validation.xml
Thanks all.
|
 |
 |
|
|
subject: Struts 2 - Client Side Validation - Date validation - Dynamic min max date
|
|
|