This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JSP and the fly likes number format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "number format" Watch "number format" New topic
Author

number format

liliya woland
Ranch Hand

Joined: Apr 11, 2006
Posts: 134
I'd like to format a number in terms of dollars and cents inside my jsp code, so without using jstl libraries. Can someone please tell me how I can do this, maybe post an example?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60041
    
  65

Originally posted by liliya woland:
without using jstl libraries.


Why not?

Can someone please tell me how I can do this, maybe post an example?


Explore java.text.NumberFormat


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rusty Smythe
Ranch Hand

Joined: Aug 09, 2006
Posts: 93
Here is a standalone app I whipped out for you:



Just steal the guts and have fun.
liliya woland
Ranch Hand

Joined: Apr 11, 2006
Posts: 134
because I'm concatinating my numbers into a String in one case and adding them up as an Integer into a sum in another case before they the numbers go into a web page. At this point I'm using
NumberFormat numformat = NumberFormat.getInstance();
It works fine when I do numformat.format(somenum)
liliya woland
Ranch Hand

Joined: Apr 11, 2006
Posts: 134
Thanks a lot Rusty!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: number format
 
Similar Threads
Need help in XSL
Problem in SimpleDateFormat
Formatting in JTable?
Number Format
API content Question