I have a problem with giving the <form:textarea />
tag a default value.
When I created a .jsp file as follow,
<form:textarea path="Content" id="my-text-box" />${content}
jsp parser translate the above line to:
<textarea id="my-text-box" name="Content"></textarea>third hello world!
Also, giving the value
attribute does not work.
<form:textarea value="${content}" path="Content" id="my-text-box" />
jsp gives me as html output:
<textarea id="my-text-box" name="Content" value="third hello world!"></textarea>
you can see the <textarea>
tag does not have the value
attribute.
How can I pass a default value to <form:textarea>
tag?
Thank you in advance.
You have to use JS along with Spring MVC to make this work. This is what I did:
Change your textarea to basic html as below:
Add a hidden input field, using spring mvc:
Add the following JavaScript: