That sounds neat, Jonathan. I hope you will share your code when you are
ready -:o)

Right now, a lot of us are in FUD lock because of JSTL and JSF. 

Something to consider in proposing new tags is how they would fit in
with the JSTL. The concern is that we don't want to lead people in a
direction that would make it harder to migrate later. Though, at the
same time, we all have applications that we need to ship today. 

Solutions like this, where the JavaBean does most of the work, sounds
like a good path to me, since it could be easily used with a JSTL
expression language later. 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Java Web Development with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/


Jonathan Gibbons wrote:
> 
> Hi,
> 
> one thing I'm doing today is:
> a) Add formatting strings to the resource bundles
> b) Adding util classes which can apply the formatting, either in form object 
>getter/setter or wherever.
> 
> Step b could be done in one of your own tag libs, but I can't be bothered to do that.
> 
> This means I can specify the format per locale, rather than use the defaults.  The 
>tricky bit is getting at the resource bundle from your
> own code.  You can do this by using the servlet context and session objects with 
>names attributes - ie the same ones used
> by struts.  Take a glance at the MessageTag class for how to.
> 
> Validation means you should do this in the form validate func as well.
> 
> Jonathan
> 
> ---------------------------------------- Message History 
>----------------------------------------
> 
> From: "Hudayioglu, Fehmi" <[EMAIL PROTECTED]> on 04/02/2002 09:52 
>CET
> 
> Please respond to "Struts Users Mailing List" <[EMAIL PROTECTED]>
> 
> To:   "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> cc:
> Subject:  AW: Formatting Dates, Integers...
> 
> thanks ted,
> we had done exactly what you've said. It works quite fine, and appears to be
> the most effortless choice we have.
> But still, in the deepness of my heart, I am not agree with the philosophy
> of business tier, I think it is a pure localization problem. But I must
> admit that adopting this sort of formatting would be very hard (I believe it
> is easy to display formatted strings by using tags, but goddamn I couldn't
> imagine how to set them back to the properties after user click that
> goddamned button).
> thanks,
> Fehmi.
> 
> -----Ursprüngliche Nachricht-----
> Von: Ted Husted [mailto:[EMAIL PROTECTED]]
> Gesendet am: Monday, February 04, 2002 3:59 AM
> An: Struts Users Mailing List
> Betreff: 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.
> 
> Generally, I add a second getter to provide the formatted version. This
> does the same thing a tag would do, but is easier to write. The actual
> formatting code I would put into a library in the business tier that the
> ActionForm method would simply call. So you could add these without
> touching your existing methods, and just have the bean:write call these
> getters instead.
> 
> Of course, if we are talking about display data, and you already have
> beans that render the formatted data, just use those. The ActionForms
> are only important for inputting data.
> 
> -- Ted Husted, Husted dot Com, Fairport NY USA.
> -- Java Web Development with Struts.
> -- Tel +1 585 737-3463.
> -- Web http://www.husted.com/struts/
> 
> "Hudayioglu, Fehmi" wrote:
> >
> > Hi fellows,
> >
> > I have searched the mailing list in hope to find a way to display a number
> > in format (e.g:120.200,32). I couldn't find any solution. There were some
> > messages proposing to play on the getter and setter methods. But, this is
> > not a solution we imagine. Because we have some object properties in the
> > Form Bean and their properties can be set by struts directly. So changing
> > getter and setter methods requires tons of effort to modify our  data
> > classes and form beans which is of course NOT desirable. I also know that
> > there is a DateTag library of Jakarta, which is yet in beta release.
> > Therefore, my managers (regards to them) don't want to use beta releases.
> > They don't want to modify struts tags neither. However, I believe this is
> > quite straightforward way (hopefully they will be contended soon).
> >
> > So,
> > 1. Do you have any clever solution for this common problem?
> > 2. What necessary steps should I take in order to add a new Format
> attribute
> > to the form:text and bean:write?
> > 2.1 In case, I added necessary methods, how can I guarantee that struts
> set
> > this formatted value to the property. According to my tries, it doesn't
> set
> > them correctly?
> > 2.2 How long does an ordinary developer require to modify struts to do so?
> >
> > thanks and my best regards,
> > fehmi.
> >
> > --
> > 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]>
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
> --
> 
> 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