I found following work around. <s:date name="createTimestmp" var="createTSFmt" format="%{getText('timeStampFormat')}"/> <s:hidden name="createTimestmp" value="%{createTSFmt}" />
where timeStampFormat is MM/dd/yyyy hh:mm:ss a.SSS With above, it retains hour, minutes and seconds, but drops milliseconds. Any other suggestions, please let me know. Sorry can't attach source JSP, because of client restrictions. To recreate: But one can create a model with java.util.Date and set is as hidden field on JSP Populate some date/time before its presented to the user. Submit form with fail validation. So now when we come back to same view/page, the time components is missing in hidden field. Thanks. Sam -----Original Message----- From: "Dave Newton" [davelnew...@gmail.com] Date: 06/06/2012 12:27 PM To: "Struts Developers List" <d...@struts.apache.org> CC: user@struts.apache.org Subject: Re: Struts 2 losing timestamp in java.util.Date when validation failed And the JSP? On Wed, Jun 6, 2012 at 12:18 PM, s <srrem...@excite.com> wrote: > > I have a form with java.util.Date (createTimestmp) and it has both date & > time. > createTimestmp is an hidden field on the form. When I fetch record from > database it has "5/17/12 12:58:33 PM.688" as value. > > If I change something on the form and if validation is GOOD, then > creatTimestmp value is retained to the original value. That is, its still > "5/17/12 12:58:33 PM.688". > > But if the validation fails, and user goes to input form again, then > createTimestmp value changes to "5/17/12". The timestamp is missing. > > Looks like a bug to me in struts 2. > > Why is struts 2 dropping timestamp on INPUT result...? > > Can someone please help. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org > For additional commands, e-mail: dev-h...@struts.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org