0

Is it possible to conserve a second decimal 0 when writing data to an html input using thymeleaf ?

If I wanted to println it I could just use a formatter in Java, how can the same be done in Thymeleaf ?

I tried using the thymeleaf formatter for numbers like this:

th:value="${#numbers.formatDecimal(exampledata,0,'POINT',2,'COMMA')}

which isn't working.

It does look like this, when writing data to input using th:value="${exampledata}":

<input value="5.0"/>

while I want it to look like this:

<input value="5.00"/>

The project, this is part of, is done in Java using Spring.

PD7
  • 96
  • 5
  • yes, that is all possible, through formatting – Stultuske Jan 03 '18 at 09:51
  • Could you give me a hint how it could be done, I'm kinda running against a wall .. – PD7 Jan 03 '18 at 09:58
  • Possible duplicate of [Format number to always show 2 decimal places](https://stackoverflow.com/questions/6134039/format-number-to-always-show-2-decimal-places) – Stultuske Jan 03 '18 at 10:02

0 Answers0