So is the answser to create global Format object and synchronize access?

-----Original Message-----
From: Jeff Martin [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 04, 2002 5:56 PM
To: Struts Users Mailing List
Subject: RE: Formatting Dates, Integers...


Be very careful about using DateFormatter's that way. I learned a hard
lesson in a previous project that DateFormater (and even just the format
method) is not thread safe.

Jeff

-----Original Message-----
From: Peter Pilgrim [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 04, 2002 7:23 AM
To: Struts Users Mailing List
Subject: Re: Formatting Dates, Integers...




Hiya

I would also consider writing some custom tags to format numbers and dates.
Subclass the Struts' own bean WriteTag <bean:write>. It is pretty easy
to check for a java.lang.Number  or java.lang.String, which you can attempt
to parse into a double.

The only problem is a creating large numbers of
java.text.NumberFormat or java.text.DecimalFormat objects.
They are expensive to create and garbage collect.
I would suggest you put a NUMBER_FORMAT_KEY in the session scope
or write the tags to reuse a global Format object.

Unfortunate I cant give you my tags, but here is a handy project
for someone to write for Struts 1.1!!!

--
Peter Pilgrim                 ++44 (0)207-545-9923

............................................ Swamped under electionic mails


---------------------------------------- Message History
----------------------------------------


From: Ted Husted <[EMAIL PROTECTED]> on 03/02/2002 21:58 EST

Please respond to "Struts Users Mailing List"
<[EMAIL PROTECTED]>

To:   Struts Users Mailing List <[EMAIL PROTECTED]>
cc:
Subject:  Re: Formatting Dates, Integers...


Pesonally, I recommend doing such things in the ActionForm. You can do
them in the page, but that means modifying the page, and placing what is
really business logic in the presentation tier. While it seems we are
talking about how data "looks", formatting it this way or that is really
a business requirement. The part about stuffing the formatted string
into HTML is the presentation tier. The J2EE blueprints call these
helper beans or methods.



--

This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.



--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>





--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

Reply via email to