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!

look at the c:fmt taglibrary from JSTL

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. :)

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.