You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by BH...@powersystems.rockwell.com on 2005/07/28 21:58:15 UTC

format

Has Anyone used the format attribute to format currency?

I have a property in an ActionForm which will hold a dollar figure and want
to format when displaying.

ie.


listPrice = 930

Need to Display $930.00


or

listPrice = 1299.9

Needs to Display $1,299.90


I have attempted the following

<bean:write name="myForm" property="listPrice" format="\\$\\d+\\.\\d\\d"/>

but that prints

\$\D+\930.\d\d

not exactly what I was hoping for :)

Re: format

Posted by BH...@powersystems.rockwell.com.
Never mind was using regular expression formatting,  Needed to use
format="$###,000.00"


                                                                           
             BHansard@powersys                                             
             tems.rockwell.com                                             
                                                                        To 
             07/28/2005 03:58          user@struts.apache.org              
             PM                                                         cc 
                                                                           
                                                                   Subject 
             Please respond to         <bean:write> format                 
               "Struts Users                                               
               Mailing List"                                               
             <user@struts.apac                                             
                  he.org>                                                  
                                                                           
                                                                           




Has Anyone used the format attribute to format currency?

I have a property in an ActionForm which will hold a dollar figure and want
to format when displaying.

ie.


listPrice = 930

Need to Display $930.00


or

listPrice = 1299.9

Needs to Display $1,299.90


I have attempted the following

<bean:write name="myForm" property="listPrice" format="\\$\\d+\\.\\d\\d"/>

but that prints

\$\D+\930.\d\d

not exactly what I was hoping for :)