aspose file tools*
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
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Format a double to 2 decimal places in struts html:text tag