Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Float precision problem?

 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am displaying emp table(oracle) data in jsp the salary column has to display up-to two precision values like 1000.50 or 10000.00

but it is showing like 10000.0 only is there any way to get the data up-to required precision.
Note:I am taking sal column as float in my bean.
 
Rajkamal Pillai
Ranch Hand
Posts: 445
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

For as similar requirement I used an different getter from the Bean (Value/Form) which would return a String value, currency formatted from the value stored in the respective data member.

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is your number defined in Oracle? Assuming it allows for at least two decimal points then you can format this how ever you like using the JSTL format tag.
 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Number(8,2)
 
Mike Zal
Ranch Hand
Posts: 144
Fedora Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSTL FMT number example
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic