bmargulies
bmargulies

Reputation: 100051

spring mvc form textarea initial contents

How do I put initial text into a Spring form textarea? The TLD rejects PCData content inside form:textarea. The point of this form is to ask a user to edit/correct some text, so the text has to get into the form in the first place. The JSP page is pulling the text from the model and wants to put it into the textarea.

Upvotes: 0

Views: 1883

Answers (1)

Javi
Javi

Reputation: 19779

You could set the initial value with Javascript. You could use tags to control when you need to set the message in the textbox so the script code will be rendered or not.

Another way it could be setting the text value in the corresponding property of the model attribute, though I think it is more clean the other solution because this message is just a help to the user, so I think it should be done in the view.

Upvotes: 1

Related Questions