struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <lau...@holoweb.net>
Subject Re: [S2] s:text help on formatting output
Date Wed, 11 Apr 2007 22:22:52 GMT
Harring Figueiredo wrote:
> Folks:
> 
> It is clear that I MUST be doing something wrong, but I have tried all the
> options with the <s:text> to format a number.
> 
> Here is what I have tried:
> <li><s:text name="currency"><s:param name="money"
> value="%{#session.Account.balance}"/></s:text></li>
> <li><s:text name="format.money"><s:param name="money"
> value="%{#session.Account.balance}"/></s:text></li>
> <li><s:text name="currency"><s:param name="money" value="122.3333
> "/></s:text></li>
> <li><s:text name="format.money"><s:param name="money" value="122.3333
> "/></s:text></li>
> <li><s:text name="currency"><s:param value="122.3333"/></s:text></li>
> <li><s:text name="currency"><s:param value='122.3333'/></s:text></li>
> <li><s:text name="currency"><s:param name="money"> 1111.199999999 
> </s:param>
> </s:text></li>
> <li><s:text name="currency"><s:param> 1111.199999999 </s:param>
> </s:text></li>
> <li><s:property value="%{#session.Account.balance}"/></li>
> 
> 
> And Here is the Corresponding output on the page:
> currency
> format.money
> currency
> format.money
> currency
> currency
> currency
> currency
> 1003.9999999999999
> 
> What in the world ami I missing?  ( I am wither misreading the example, or
> it is clearly not correct. I hope it is the former)
> 
> I followed the example on this page:
> http://struts.apache.org/2.x/docs/text.html
> 
> Other example
> 
> <s:text name="format.money"><s:param name="value"
> value="myMoneyValue"/></s:text>
> 
> where
> 
> format.money={0,number,currency}
> 
> 
> Thank you in advance for any input.
> 
> hf
> 

None of your attempts actually follows the example, though; you're using 
<s:param name="money" ... instead of <s:param name="value" ...

Try this:

     <s:text name="format.money">
         <s:param name="value"
             value="%{#session.Account.balance}"/>
     </s:text>

 From your sample output it looks like you haven't set up the 
format.money or currency resource strings, either, which you will need 
to do.

L.


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


Mime
View raw message