【问题标题】:How to do this using Thymleaf?如何使用 Thymeleaf 做到这一点?
【发布时间】:2017-09-23 22:09:36
【问题描述】:

这是我使用 JSP 的代码:

<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>

这是我尝试的:

<input type="hidden" name="${_csrf.parameterName}"  th:attr="value = ${_csrf.token}"/>

我不知道如何将值归因于 html 的名称。

【问题讨论】:

    标签: java html jsp thymeleaf


    【解决方案1】:

    这应该是这样的:

    <input type="hidden" th:name="${_csrf.parameterName}"  th:value="${_csrf.token}" />
    

    List of thymeleaf attributes.

    【讨论】:

      猜你喜欢
      • 2019-09-19
      • 2019-04-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-03
      • 2013-10-14
      相关资源
      最近更新 更多