struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Dunn" <>
Subject RE: Formatting dates in <html:text>
Date Wed, 26 Mar 2003 18:37:14 GMT
The JSTL <fmt:formatDate> is great for display only.

IMHO there should be a way to format a date, or round a float to 2 decimal
places etc. built into the html:form tags to work with the property you've
got.  It would defeat i18n but if you need a certain format, you aren't
using it anyhow.  It seems there are many people using all sorts of
different workarounds.

I'm relatively new at this, so I could be way off base.  I'd like to know if
I am but try to be kind if I'm being a moron. ;-)


-----Original Message-----
From: Edgar Dollin [mailto:Edgar@BLUE-MOOSE.NET]
Sent: Wednesday, March 26, 2003 12:10 PM
To: ''; 'Struts Users Mailing List'
Subject: RE: Formatting dates in <html:text>

If you just want to display, the <bean:write> tag has some date formatting

For entry the 'best' current solution is to subclass the TextTag class and
do your processing there.  The strategy I have been using in such a tag is
to use a 'hidden' field with your actual form data and javascript to do the
translations to another field the user actually edits, of course returning
the altered text to your hidden field.

One of the javascript guys was asking about a hypothetical date tag, but I
don't remember the details or the status.


> -----Original Message-----
> From: Greg Dunn []
> Sent: Wednesday, March 26, 2003 11:52 AM
> To: 'Struts Users Mailing List'
> Subject: Formatting dates in <html:text>
> I'm trying to display a date in a particular format in an
> <html-el:text> box.  I'm filling my form bean from my DAO
> which returns a timestamp, and
> <html-el:text size="10" property="presReadingDate"
> value="${meterReading.dtPresReadDt}"/>
> displays the long date/time format 'Tue Mar 26 10:45:59 CST
> 2003' which is no good.
> I was looking at a discussion on this topic in the archives,
> but it appears that it was left as "food for thought"

I use the JSTL <fmt:formatDate> tag to display a date outside a form, but it
can't be nested so it's no good here.

This scenario seems like it would be fairly common.  What does one do here?
Format the date in a get/set pair in their bean and display that?  Use basic
HTML <input type="text"> tags?  What's best practice?



To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message