• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

compare the date field with the current date in struts 2 validation.xml

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, i want to compare the date field with the current date. for that i need current date into the validation.xml file so that i can compare it how can i implement it i m using struts2. how can we compare in validation.xml??
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using OGNL, but to be honest, I'd do this in a validate() method. Anything beyond the most simple stuff I take out of XML configuration.

You could also write a custom validator.
 
vydehi vajanapally
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the update.
May i know the advantage of using validate() instead of validation.xml

one more question-- we can do server side validations in 3 ways right,
1) using annotations
2) using validate()
3) using validation.xml

Which one will take high precendence if i am doing the validations in all the above ways for the same field/ form element.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

vydehi vajanapally wrote:May i know the advantage of using validate() instead of validation.xml


Easier unit testing and re-use.

Which one will take high precendence if i am doing the validations in all the above ways for the same field/ form element.


Honestly, I don't remember... I *think* it's XML, annotations, then validate, but could be completely wrong--it'd be easier to just test.
 
Greenhorn
Posts: 1
Eclipse IDE Tomcat Server Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The precedence is
Validation.xml
annotations
validate()
 
This one time, at bandcamp, I had relations with a tiny ad.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic