IMHO, localisation is part of the business tier too. With static messages that apply to all users, Struts provides a common resource and a common way to access that resource. But the message resource files are really part of the business tier; Struts is just provide a means to access them. (This is more evident in the nightly build, where we remembered to take the HTML out the messages resources.)
But the Struts message resources is not always the only i18n player in the game. People often have substantial i18n resources of their own, which are better exposed through custom beans or routing to different page trees, via the controller, than through a series of bean:message calls on the page. If i18n is part of the formatting here, you can of course tie into the same controller system by keying on the same locale object. The key question is what happens when we needs to present the same dynamic information on something besides a web page? (Say a PDF or true Excel spreadsheet using POI.) The bean:message tags use standard bundles that any JavaBean could reference. Any other i18n or formatting system should also likewise be available to beans using another presentation system. -- 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: > > 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]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>