struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Krygowski <>
Subject RE: java.util.Dates and Struts
Date Mon, 23 Dec 2002 18:33:59 GMT
Hi Rick-

Yep, you've got it.  I had the formatting tags you suggest in the back of my
mind all along.  But when I saw the converters you created, they looked like
a really elegant solution.  Unfortunately, I sort of forced my own set of
assumptions on them (cognitive dissonance?).  Still, I can use the
String->Date for bringing things back to the JSP which is nice.  Many, many
thanks for that contribution.  Aside from being useful, it pushed me down a
path in the Struts/BeanUtils source code that I had yet to travel.

As regards the tags, I would like to render an html input type="text".  As
far as I know, you can't nest tags so...

<html:text name="myForm" property="myDate" value="<fmt:formatDate
pattern="MM/dd/yy" value="${element.yourDate}"/>"/>

...won't work.

I suppose a Page Context dynamically defined bean might do the trick, but
since I haven't delved into JSTL I'm not sure how to do that.  Are you using
your formatted dates in editable fields.  If so, would you mind sharing how
you're setting up your tags?


> -----Original Message-----
> From: Rick Reumann []
> Sent: Monday, December 23, 2002 3:51 PM
> To: Struts Users Mailing List
> Subject: Re: java.util.Dates and Struts
> On Mon, 23 Dec 2002 12:32:13 -0500
> Jim Krygowski <> wrote:
> > It seems like the only way things work out properly in the rendering
> > phase is to have a ValueObject that contains the Date properties and
> > an ActionForm that has a String for each Date on the ValueObject.
> > This is what I was originally hoping to avoid.  My ActionForm contains
> > graphs of ValueObjects that I render using the nested tags.  It'd be
> > really painful to come up with a parallel set of ValueObjects that
> > have Strings instead of Dates.
> >
> > Is there any way to get formatted Dates from the <html:text> and like
> > tags or am I stuck?
> I must be missing something here:) I think I see what you are doing
> now... you are wanting to use the ValueObject in the jsp display. In
> that case why not just use of the tag libraries that display dates in
> whatever format you like. Then you won't even need to bother with the
> converters or BeanUtils. To format Dates in jsp pages I now use the JSTL
> format tags. It's then simply a matter of doing
> <fmt:formatDate pattern="MM/dd/yy" value="${element.yourDate}"/>
> I'm sure you could define the pattern globally for the whole page, I
> just was lazy and didn't look into it.
> I think that will solve your problem?
> --
> Rick
> --
> To unsubscribe, e-mail:
For additional commands, e-mail:

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

View raw message