struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Earl Woodman" <earl.wood...@verafin.com>
Subject RE: Moving from bean:write to fmt:formatNumber
Date Tue, 04 May 2004 18:59:17 GMT
Thanks for your response Kris.

This seems a bit hairy... when I use bean:write, the key comes from my
application resources file nicely, but with this fmt, I have to use a bundle
of some sort. Why is this more complicated than the bean:writes? 
 
Earl

-----Original Message-----
From: Kris Schneider [mailto:kris@dotech.com] 
Sent: Tuesday, May 04, 2004 3:34 PM
To: Struts Users Mailing List
Subject: Re: Moving from bean:write to fmt:formatNumber

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






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


Mime
View raw message