struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mike.ra...@barclayscapital.com
Subject RE: Formatting date values
Date Thu, 15 Apr 2004 14:01:45 GMT
You should keep all your form types as string - then you do not get
conversion problems. Do your validation in the validate() method. Format
your date using a DateFormat object before redisplaying.


-----Original Message-----
From: Paulo Rezende [mailto:java@pmbr.net] 
Sent: 15 April 2004 14:57
To: struts-user@jakarta.apache.org
Subject: Formatting date values


Hi friends,

My ActionForm has a Date property. 

First I need to renderize it formatted. Since the html:text has no format
property, i did this:

<input type="text" name="data" id="data" value="<bean:write name="GridForm"
property="data" format="dd/MM/yyyy" />">

Another way?

Second I need to submit the value inserted in the html:text by user, to this
same Date property.

But when i submit the page, de BeanUtils.populate throws a error, because it
can not do the automatic conversion from String to Date.

How it could be done automatically?

tks, Paulo Marcio


------------------------------------------------------------------------
For more information about Barclays Capital, please
visit our web site at http://www.barcap.com.


Internet communications are not secure and therefore the Barclays 
Group does not accept legal responsibility for the contents of this 
message.  Although the Barclays Group operates anti-virus programmes, 
it does not accept responsibility for any damage whatsoever that is 
caused by viruses being passed.  Any views or opinions presented are 
solely those of the author and do not necessarily represent those of the 
Barclays Group.  Replies to this email may be monitored by the Barclays 
Group for operational or business reasons.

------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message