spring - thymeleaf 使用动态参数/元素生成 REST url

标签 spring rest url thymeleaf

我想使用 thymeleaf 创建 REST url。我有这样的东西:

<a th:href="@{customer/(${c.id})/edit}">Edit</a>

输出为: http://localhost:8080/app/customer/($%7Bs.id%7D)/edit

但我想得到:http://localhost:8080/app/customer/4/edit

我怎样才能实现这个目标?请帮忙。

最佳答案

您需要的名称为 Preprocessing ,只需点击链接即可!

就您而言,您应该这样做:

<a th:href="@{customer/__${c.id}__/edit}">Edit</a>

关于spring - thymeleaf 使用动态参数/元素生成 REST url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27324137/

相关文章:

java - Spring 数据休息 : RepositoryRestController deserialization from URI not working

java - 为什么消息卡在安慰服务器上?

javascript - 使用 Jest 测试对 API 的真实请求的状态代码

javascript - 从当前 URL 获取#id

python - 带有可选参数的 View 中的 Django 永久链接

spring - Camel : Jetty response encoding

java - 使用 Spring Data Rest @Projection 作为自定义 Controller 中资源的表示

javascript - Axios:无法使用基本身份验证调用 API

java - 未找到 Java 类的消息正文编写器

url - 逃脱 | Wiki 标记模板中 URL 中的(垂直条/管道)