• Post Reply Bookmark Topic Watch Topic
  • New Topic

Formatting Currency Value in JSTL

 
Hiren Pathak
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everybody,
I have a question about <fmt:formatNumber>. I have this Double value coming from database mapped object which I am displaying using JSTL. I want to display that value in millions with 3 digits precision value. I looked around for the solution but couldnt find anything.

currently I am using it something like this..


is there any pattern for that ? any help would be a great help.

Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The pattern attribute to the tag can specify a pattern to be used for formatting that adheres to the format expected by the java.text.DecimalFormat class.

The JSTL 1.1 Specification description of the formatNumber action goes into greater detail.
[ June 02, 2006: Message edited by: Bear Bibeault ]
 
Hiren Pathak
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
The pattern attribute to the tag can specify a pattern to be used for formatting that adheres to the format expected by the java.text.DecimalFormat class.

The JSTL 1.1 Specification description of the formatNumber action goes into greater detail.

[ June 02, 2006: Message edited by: Bear Bibeault ]



Thanks Bear,
Thanks for the link. I think I had to divide the value coming from DB with 1000000 to get the desired value in millions.

I was thinking if JSTL has something which does that for us but anyways its working find.
Thanks again.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!