User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 397,983 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,719 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 1163 | Replies: 3
Reply
Join Date: Aug 2007
Posts: 2
Reputation: gwong is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
gwong gwong is offline Offline
Newbie Poster

format output in jsp files

  #1  
Aug 16th, 2007
Hi,
I was wondering if it's possible to use the sprintf or any kind of print statements that formats your output into a particular format. The value that is passed to me is "45.0", and I would like the output to be displayed as "45.00".

Thanks for any replies!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,661
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 193
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: format output in jsp files

  #2  
Aug 16th, 2007
look at the c:fmt taglibrary from JSTL
42 Private messages asking for help will be ignored
In the frozen land of Nador they were forced to eat Steve's iMinstrels, and there was much rejoicing.
Reply With Quote  
Join Date: May 2007
Location: USA
Posts: 2,639
Reputation: Ezzaral is a glorious beacon of light Ezzaral is a glorious beacon of light Ezzaral is a glorious beacon of light Ezzaral is a glorious beacon of light Ezzaral is a glorious beacon of light 
Rep Power: 11
Solved Threads: 261
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Posting Maven

Re: format output in jsp files

  #3  
Aug 16th, 2007
Yes, there are several Java formatters available. Formatter is a generic formatter like printf or sprintf. It can be used with String.format() or also PrintStream's printf() function. NumberFormat, DecimalFormat and DateFormat are also available for formatting string representations.

Edit: Or, yeah, see the template library jwenting posted above if you are wanting JSP tags.
Last edited by Ezzaral : Aug 16th, 2007 at 1:04 pm.
Reply With Quote  
Join Date: Aug 2007
Posts: 2
Reputation: gwong is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
gwong gwong is offline Offline
Newbie Poster

Re: format output in jsp files

  #4  
Aug 16th, 2007
Originally Posted by Ezzaral View Post
Yes, there are several Java formatters available. Formatter is a generic formatter like printf or sprintf. It can be used with String.format() or also PrintStream's printf() function. NumberFormat, DecimalFormat and DateFormat are also available for formatting string representations.

Edit: Or, yeah, see the template library jwenting posted above if you are wanting JSP tags.


Thanks alot guys! the fmt tag library did the trick.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JSP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 1:06 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC