*
The moose likes Struts and the fly likes Format a double to 2 decimal places in struts html:text tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Format a double to 2 decimal places in struts html:text tag" Watch "Format a double to 2 decimal places in struts html:text tag" New topic
Author

Format a double to 2 decimal places in struts html:text tag

Cory Max
Ranch Hand

Joined: Jul 20, 2005
Posts: 83
Hi everyone,

I am trying to format a double value to two decimal places in a struts html:text tag. ex)

<html:text property="freight" size="9" maxlength="9"/>

the value inside freight is a double for example $100. When it displays, it shows it as 100.0, not 100.00 (like I want it to).

I would like to display all double values to two decimal places but the html:text does not have a format property.

Could someone please help?


There are only 10 types of people in this world... Those who understand binary and those who don't.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Format a double to 2 decimal places in struts html:text tag
 
Similar Threads
types bettween mysql and java
Decimal formatting of
Decimal formatting of
Formatting display
How to find number of decimal places?