struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Dunn" <greg.d...@mo.nisc.cc>
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. ;-)


Greg




-----Original Message-----
From: Edgar Dollin [mailto:Edgar@BLUE-MOOSE.NET]
Sent: Wednesday, March 26, 2003 12:10 PM
To: 'greg.dunn@mo.nisc.cc'; '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
options.

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.

Edgar

> -----Original Message-----
> From: Greg Dunn [mailto:greg.dunn@mo.nisc.cc]
> 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"
>
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg52386.html

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?

Thanks,


Greg


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




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


Mime
View raw message