Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Re: formatting money values with bean:write

Laurie Harper

2007-01-31

Replies:

Adam Lipscombe wrote:
> Folks
>
>
> I am using "<bean:write name="myBean" property="myBeanProperty"
> formatKey="global.moneyFormat"/>
>
> global.moneyFormat is defined in the vanilla
> ApplicationResources.properties file as "#,##0.00"
>
> To support users in France and Germany there are also
> ApplicationResources_fr and ApplicationResources_de property files.
> These define the moneyFormat as "# ##0,00" and "#.##0,00". This all
> works fine.
>
>
> But, when a user accesses the system from a client whose locale uses a
> non-USA/UK style currency format string and the locale is NOT France or
> Germany (e.g. "#.##0,00" - Portugal or Brazil) the system fails with
> "javax.servlet.ServletException: Wrong format string: '#,##0.00'"
>
>
> I think what is happening is that the system is using the default
> "global.moneyFormat" property String from the vanilla
> ApplicationResources file (which is what I would expect).
> But when this default pattern is applied it does not match the one
> expected by the client-side locale and so the pattern application fails.
>
>
> What I thought was supposed to happen was that if an appropriate
> ApplicationResources_XX.properties file could not be found the
> "global.moneyFormat" property from the vanilla properties file would be
> used and simply applied?
>
>
> Does anyone know what is supposed to happen?
> Is it necessary to have a separate ApplicationResources_XX props file
> for every locale that might access the system? Surely not?
>
>
> TIA - Adam

No, it should work as you expect. What's the full stack trace (including
root cause)?

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.