Guess it would help if I read your entire email ;)
How about this:
format.number= {0,number,\u00A4###,##0}
-or-
format.number= {0,number,'USD'###,##0}
On Fri, May 1, 2009 at 1:26 PM, Burton Rhodes <[email protected]> wrote:
> I solved it this way:
>
> <s:textfield key="netpl" value="%{getText('format.money',netpl)}" />
>
> Then in your class path put a file called package.properties with the
> following:
>
> # used to format dates, numbers in the jsp files (display)
> format.time = {0,time}
> format.dateShort = {0,date,MM/dd/yyyy}
> format.number = {0,number,###,##0.0##}
> format.percent = {0,number,##0.00'%'}
> format.money = {0,number,\u00A4###,##0}
> format.moneyDecimal = {0,number,\u00A4###,##0.00}
>
>
> On Fri, May 1, 2009 at 12:01 PM, akoo <[email protected]> wrote:
>>
>> 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: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]