This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Trim in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Trim in java" Watch "Trim in java" New topic
Author

Trim in java

rose hegde
Ranch Hand

Joined: Oct 22, 2003
Posts: 40
Hello,
I am getting a result from java file which is of type double.When displaying this number through jsp file i want only 2 digits to appear after decimal point.
Pls help
Benny Tang
Greenhorn

Joined: Aug 03, 2003
Posts: 26
Hi,
You can use the method setMaximumFractionDigit() in java.text.NumberFormat to manipulate the format of the number.
Benny T
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

This really has nothing to do with JSPs, so I'm moving it along to Java In General (Beginner).
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
rose hegde
Ranch Hand

Joined: Oct 22, 2003
Posts: 40
Can anyone tell me exactly how to do this?
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
Check the API docs for DecimalFormat and NumberFormat


42
 
jQuery in Action, 2nd edition
 
subject: Trim in java
 
Similar Threads
create tables using java code by fetching from .sql file
CD Rom auto run
Ant error: Make sure you have it in you classpath
JSP and Java wait help
CD Rom auto run