Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

struts date validator for yyyy-MM-dd HH:mm:ss

Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • 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-value>yyyy-MM-dd HH:mm:ss</var-value>

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.

[ May 07, 2008: Message edited by: Wilson Gordon ]
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you solve this problem ? I have stucked in this same place as you :/

If you send is by car it's a shipment, but if by ship it's cargo. This tiny ad told me:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic