如何使用 thymeleaf 获取 textarea 数据 [英] How to grab textarea data using thymeleaf

查看:114
本文介绍了如何使用 thymeleaf 获取 textarea 数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含字段的数组,我使用 textareas 将其中的字段输出到 html 中,以便用户可以编辑它们并再次保存它们.

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.

我可以使用我拥有的 set 方法设置数据,但我不确定如何获取用户输入的 textarea 文本以将其传递给该方法.我也在使用 Thymeleaf.

I can set the data using a set method I have, but I'm not sure how to get the textarea text the user entered to pass it into the method. I'm using Thymeleaf also.

<td>
   <textarea name = "fitNumber" class="form-control input-sm" rows="1"
                                    th:value="${fit.setFitNumber(Need value set here)}">
   </textarea>
</td>

编辑

我会稍微改写一下,因为它读起来不正确.

I'll rephrase a little, as it reads incorrectly.

你能在 Thymeleaf 的 setter 中传递一个变量吗?例如${person.setName(name)}

Can you pass a variable within a setter in Thymeleaf. e.g. ${person.setName(name)}

此外,传递的参数是否可以是