【问题标题】:href in Thymeleaf百里香中的href
【发布时间】:2018-09-07 13:55:26
【问题描述】:

我有一个带有 appContext platsBruts 的 SpringBoot 应用程序,但我不知道如何在不对 appContext 进行硬编码的情况下设置 href,以下示例均无效

<a th:href="/*[[@{/pistoles/list/}]]*/" class="pure-menu-link">

出现错误:

Could not parse as expression: ="/*[[@{/pistoles/list/}]]*/"

<a href="/pistoles/list/}" class="pure-menu-link">

【问题讨论】:

  • 你在用百里香吗?

标签: html spring-boot thymeleaf


【解决方案1】:

不确定您是否在最后的 href 值中输入了错误的“/}”。

<a href="/pistoles/list/}" class="pure-menu-link">

试试这个:

<a th:href="@{/pistoles/list}" class="pure-menu-link">

但请确保将下面的 thymeleaf 命名空间包含在 html 文件的顶部以使其正常工作。

<html xmlns:th="http://www.thymeleaf.org">

【讨论】:

    【解决方案2】:

    不确定您是否使用百里香叶。如果您使用的是百里香,这应该可以工作

    <a th:href= "@{/pistoles/list/}" class="pure-menu-link">
    

    【讨论】:

      猜你喜欢
      • 2018-02-21
      • 2017-07-31
      • 2020-12-30
      • 2021-01-09
      • 2013-09-10
      • 1970-01-01
      • 1970-01-01
      • 2021-01-08
      • 1970-01-01
      相关资源
      最近更新 更多