I want to display default values in my input fields, so I followed answers in this stack overflow question (basically replacing th:field with th:value). Nevertheless when I tried to use the same strategy with textarea, it did not work. Why not? How do I achieve the same effect with a textarea?
<textarea />
doesn't have a value attribute. Use th:text
instead.
Alternatively, you could switch to th:field
which will work the same for both <input />
and <textarea />
. (When you use ``th:field`, you set the default value by setting correct property on your object rather than setting it in the HTML.)