【问题标题】:Spring MVC - Thymeleaf th:action th:objectSpring MVC - Thymeleaf th:action th:object
【发布时间】:2020-02-17 01:50:36
【问题描述】:

我正在使用 Spring MVC 和 Thymeleaf。 我的模板在表单标记处如下所示:

<form method="post" class="from-group">
</form>

它有效,但没有th:action th:object。 我非常喜欢这个(非常简单),但我没有找到任何解释。

没有 th:action 和 th:object 怎么办?

【问题讨论】:

    标签: spring-mvc binding thymeleaf


    【解决方案1】:

    当您单击提交按钮时,如果您不包含th:action,它将重定向到您所在的当前页面。例如:如果th:action="home",它会在您提交表单时将您重定向到../home。 th:object 是您想要响应的对象类型。例如:一个名为“人”的对象,它具有姓名、性别、出生日期等。你不需要使用它。

    【讨论】:

      猜你喜欢
      • 2018-01-07
      • 2018-06-12
      • 2019-06-28
      • 2021-11-19
      • 2014-07-10
      • 1970-01-01
      • 1970-01-01
      • 2015-02-19
      • 2017-06-17
      相关资源
      最近更新 更多