• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

date comparison in struts

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 !!!
 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:

validation-rules.xml:



validation.xml:



test.DateRangeValidator.java:


MessageResources.properties



Hope this helps.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used! Works fine for me! Besides of 3 years later from the original message.

Thanks!
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi friends very thanks .......
 
All that thinking. Doesn't it hurt? What do you think about this tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic