Adam Lipscombe wrote:
Folks

I need to internationalize an app - returning Locale specific formats for currency and date.

One way to do that is to add getLocalised<PropertyName>() and setLocalised<PropertyName>() to the formbeans for each affected property. These methods will then apply whatever formatting is needed.

Ugh, you'd have to have a seperate getter/setter pair for every locale you wanted to support, and how would you know which one to call in the JSP?

But, for the <bean:write> tag to work this involves having an extra getter/setter for each property that needs localisation.

Is there anyway round this? Is there an accepted solution?

Your getters/setters shouldn't need to know about the locale, they just make the data available. Formatting for locale should happen in the view. Format strings go in your per-locale resource bundle, and are referenced with the formatKey attribute of the bean:write tag [1].

There are other ways to do the same thing (including using the JSTL 'fmt' tags/functions instead of bean:write), but the objective is the same: make formatting data part of your localization resources.

L.

[1] http://struts.apache.org/1.x/struts-taglib/tlddoc/bean/write.html


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

Reply via email to