• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Formatting Currency Value in JSTL

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic