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

struts 2 xml validation, how to get current date ?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi, maybe I'm missing something very obvious, but this thing here has been bedeviling me for many hours, google couldn't give me a solution either.

Here's my xml validation file snippet

<field name="employeeBean.employeeBirthDate">
<field-validator type="fieldexpression">
<param name="expression">
<![CDATA[employeeBean.employeeBirthDate < Current Date]]>
</param>
<message>Birthdate invalid</message>
</field-validator>
</field>

But I can't seem to find a way to get the current date or time in the xml validation file anywhere. Help would be much appreciated.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch.
Whenever I have a task more complex than the most basic validation (i.e. required field), I write my validations in the Action validate method.
You could also write your own validator to validate against today's date and use that.
 
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic