struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Schneider <k...@dotech.com>
Subject Re: Moving from bean:write to fmt:formatNumber
Date Tue, 04 May 2004 18:04:01 GMT
There are (at least) a couple options. One would be to create a property like:

numberFormat={0,number,#.##}

And then use <fmt:message>:

<fmt:message key="numberFormat">
  <fmt:param value="${aNumber}"/>
</fmt:message>

Another would be to leverage the fact that the pattern attribute of
<fmt:formatNumber> accepts an EL expression. So, you'd load the pattern and
then do:

<fmt:formatNumber value="${aNumber}" pattern="${numberPattern}"/>

There are all kinds of ways you could load the pattern, but one would be:

<fmt:message key="numberPattern" var="numberPattern"/>

Quoting Earl Woodman <earl.woodman@verafin.com>:

> Hi,
> 
> I'm trying to move from bean:writes to fmt:formatNumber in my application,
> but I'm finding that in order to format a number, I can't get a formatting
> pattern from my application resources file - there doesn't seem to be a key
> parameter in the fmt:formatNumber tag. Has anyone run into this problem in
> the past and what have you done about it?
> 
> Thanks a lot,
> Earl
>  
>  
> 
> Earl Woodman
> Software Developer
> Verafin Inc
> earl.woodman@verafin.com

-- 
Kris Schneider <mailto:kris@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message