java - Display normal (double) instead of scientific numbers - MVC Application -
i know how format double 9.78313e+10 display 97831300000 in java.
but have mvc application , there getter @ view part double like:
<td><input type="number" step="0.00000001" th:placeholder="'current: '+ *{product.gettop()}" name="top"/></td>
my problem view displays 9.78313e+10.
a workaround second getter object formats double string , returns then.
is there more elegant way solve problem with thymeleaf?
there indeed function provided thymeleaf format numbers. please check official document of formatdecimal.
string formatdecimal(number target, integer minintegerdigits, integer decimaldigits)
the first argument number format. second argument minimum number of digits display integer part, , third argument maximum number of digits display decimal part. in example, format 9.78313e+10
97831300000
, #numbers.formatdecimal(9.78313e+10, 11, 0)
exact trick.
Comments
Post a Comment