• 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 date validator for yyyy-MM-dd HH:mm:ss

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

In my valdiation.xml file, I have the following validation for a field that should be in this yyyy-MM-dd HH:mm:ss format.

<field property="myTimestamp" depends="required, date">
<arg0 key="myTimestamp" resource="false"/>
<arg1 key="yyyy-MM-dd HH:mm:ss" resource="false" />
<var>
<var-name>datePatternStrict</var-name>
<var-value>yyyy-MM-dd HH:mm:ss</var-value>
</var>
</field>

The straneg thing is when the value in the form field matches the specified format, it still gives the error "myTimestamp should be in yyyy-MM-dd HH:mm:ss" format.

When I change the form field value to just yyyy-MM-dd, strangely it passes the validation.

Any idea how to get yyyy-MM-dd HH:mm:ss validatin to work?

I use Struts 1.1.

Thanks.
[ May 07, 2008: Message edited by: Wilson Gordon ]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Did you solve this problem ? I have stucked in this same place as you :/

Regards
Jan
 
I wish to win the lottery. I wish for a lovely piece of pie. And I wish for a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic