struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akoo <ogen...@yahoo.com>
Subject number formatting (with commas)
Date Fri, 01 May 2009 17:01:57 GMT

Hi guys, 
I have looked through all of the documentations and am just not having any
success formatting numbers (i.e 70333 -> 70,333)  so I thought i'd ask you
guys.  here are relevant snippets of my code.

  <s:iterator value="positions">
<tr>

              <td><s:property value="account"/> </td>
              <td ><s:property value="symbol"/> </td>
              <td><s:text name="format.number"><s:param name="value"
value="netpl"></s:param></s:text></td>
</tr>

Positions in the above code is a list of position objects 
class Position
{
    private String symbol;
    private String account;
    private float netpl;
    //followed by getters and setters for all of the above field
}

The Action class FirmwidePositionAction  returns the list of positions after
querying the the database

What I want is for the netpl number to show up formatted properly with the
comma placeholders and a 'USD' prefix,  so I created the package.properties
file and placed it in the same package as the action class.
Here is my package.properties file

format.time = {0,time}
format.number = USD{0,number,##0.00}
format.percent = {0,number,##0.00'%'}
format.money = {0,number,\u00A4##0.00}


The numbers all show up perfectly. However, I am not able to get the 'USD'
to appear in front of the netpl columns.  What am I doing wrong here?

Thanks

-- 
View this message in context: http://www.nabble.com/number-formatting-%28with-commas%29-tp23336400p23336400.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message