struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ravindran Ramaiah <>
Subject RE: Dates and Struts
Date Wed, 22 Aug 2001 13:32:02 GMT
We have developed a utility class for Date manipulation.
Attached the java file.

Hope this helps.

-----Original Message-----
From: Gregor Rayman []
Sent: Wednesday, August 22, 2001 8:01 AM
Subject: Re: Dates and Struts

"Matt Raible" <> wrote:

> Is it true that Struts cannot handle a java.sql.Date or java.util.Date
> datatype?  I seem to get errors everytime I try to have one in my form.
> Thanks,
> Matt

No it cannot. Date is not so easy to parse since it is locale dependent.
Also the displaying a date is not easy.

This brings me to one general architecture question:

Where do you (I mean all struts users) put the formatting/parsingĀ“of

For display only data, I try to put it into the JSP (with custom tags).

But what about the editable data? Is the ActionForm the right place?

I store the data in non-string form (like Date) and the get/set methods
operate with strings. The language dependent formats use an addiotional
property "locale" which I set either in the reset() method (from request
and session).

It could be done simpler, I used only string aware ActionForms and the
whole formatting were done in Action.perform, but this wouldn't be conform
with the MVC pattern, woul'd it?


View raw message