This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes date comparison in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "date comparison in struts" Watch "date comparison in struts" New topic

date comparison in struts

ratnesh mathur

Joined: Jun 20, 2006
Posts: 1
dear all i am using struts 1.1 and i want to compare to date fields using validation-rules.xml and validation.xml by making my own method to compare the bigger between them .
plz help i am new user !!!
Durgaprasad Guduguntla
Ranch Hand

Joined: Oct 20, 2003
Posts: 99
You need to write a custom validator in which you can fetch the values of the two date fields and validate them and then
throw the error messages accordingly. There are two error conditions - the two dates might be equal or end date is earlier begin date.
If you are using Struts1.1, you might need to change the method
signature of the validator to ActionErrors in place of ActionMessages. The following code would help you:



Hope this helps.

Thanks,<br />Durgaprasad<br />SCJP1.4, SCWCD1.4, SCBCD1.3,<br />SCEA
Reinaldo de Oliveira Castro

Joined: Jul 06, 2006
Posts: 3
I used! Works fine for me! Besides of 3 years later from the original message.

david merlin

Joined: Oct 24, 2009
Posts: 3
hi friends very thanks .......
I agree. Here's the link:
subject: date comparison in struts
Similar Threads
Double Iteration
Struts two filed comparison
Date picker in struts 1.1
Comparision of date using javascript
future date validation