Thymeleaf href url

时间:2018-05-17 13:18:44

标签: spring-boot thymeleaf

我正在尝试通过遍历列表来动态生成页面中内容的链接,但我得到了解析错误'

我在https://www.thymeleaf.org/doc/articles/standardurlsyntax.html中提到过:

        <li th:each="param : ${paramList}">
            <span th:text="${placeholder}">This is displaying the value of placeholder correctly</span>

            <!-- The value I am trying to achieve is href="/member/team/ValueFromPlaceholderVariable?team=TeamName&page=PageName" -->

            <a th:href="@{/member/team/{PlaceName}(PlaceName=${placeholder},team=${param.TeamName},page=${param.PageName})}">Page</a>
        </li>

代码:

{{1}}

如何生成href链接?

1 个答案:

答案 0 :(得分:0)

删除开头的斜杠

<a th:href="@{member/team/{PlaceName}(PlaceName=${placeholder},team=${param.TeamName},page=${param.PageName})}">Page</a>