How To Grab Textarea Data Using Thymeleaf
I have an array with fields, of which I've output onto html using textareas so that a user can edit them and save them again. I can set the data using a set method I have, but I'm
Solution 1:
You have a ways to go for this... you need to read up on creating thymeleaf forms (and maybe the whole spring MVC process).
http://www.thymeleaf.org/doc/tutorials/2.1/thymeleafspring.html#creating-a-form
In answer to your question, should be using a form that looks like this:
<formth:object="${fit}"><textareaclass="form-control input-sm"rows="1"th:field="*{fitNumber}" /></form>
th:object in combination with th:field automatically binds the value of the textarea to your object when you submit the form -- when you submit the form, spring will call fit.setFitNumber(value from input area) behind the scenes and your controller method will have the fit object passed to it as a parameter.
Solution 2:
Use th:field
, that is auto set into the textarea
Post a Comment for "How To Grab Textarea Data Using Thymeleaf"