1

in my page jsp I have a double property ${ bean.property } but it display like this :

1.598E7

how can I make it to with out E7 and replace it with 0 like 15980000

Hayi
  • 6,972
  • 26
  • 80
  • 139

1 Answers1

2

use formatNumber

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<fmt:formatNumber type="number" maxFractionDigits="5" value="${bean.property}" />
jmj
  • 237,923
  • 42
  • 401
  • 438
  • do you need more for display purpose ? – jmj Feb 17 '15 at 18:12
  • like what ? i try it without `maxFractionDigits="5"` and it works that i ask you. – Hayi Feb 17 '15 at 18:14
  • it is non required attribute, so it will work without it as well with default behavior, if you don't want more digits in display you could control with this attribute (which is usually the case) – jmj Feb 17 '15 at 18:15
  • i got it now it's for To display the numbers on JSP with maximum number of digits after decimal point so i choose to put 2 instead of 5 – Hayi Feb 17 '15 at 18:33
  • 1
    ok you could refer to doc http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/fmt/formatNumber.html and play around with more attributes if required – jmj Feb 17 '15 at 18:44
  • thanks man for your help ... you can add it to your answer for more details. – Hayi Feb 17 '15 at 18:48