Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Cory Max
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!