File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

formatting amounts

 
gino mendoza
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone help with formatting amounts to be displayed using JSP?
Thanks.
 
sunitha reghu
Ranch Hand
Posts: 937
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DecimalFormat df = new DecimalFormat("00000000.00");
df = (DecimalFormat)NumberFormat.getInstance(Locale.US);
//Locale can be changed to ur req:
df.format(your amt)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your best bet is to use the fmt JSTL tags.
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Formatting is more to do with your helper functions that are available for your application rather than JSP.
You can create a amount formatter method in a singleton helper class(that has other formatting functions aswell) and access that method from JSP.
The method is obviously static.
Kishore.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why create singleton "helper" classes when a standardized, page-centric solution already exists?
 
Kishore Dandu
Ranch Hand
Posts: 1934
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I explained what I am using.
If you think format is the best bet(using JSTL) let it be
Kishore.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic