gpt4 book ai didi

java - 来自 :text nested in th:action in thymeleaf 的值

转载 作者:行者123 更新时间:2023-12-01 17:53:34 26 4
gpt4 key购买 nike

我想在 th:action 中使用 car.id 中的值。下面的代码将用户重定向到 id 为 1 的汽车页面,因此我想将“1”替换为“${car.id}”:

               <p th:text="${car.id}" />
<form action="#" th:action="@{/cars:1}" method="get">
<p><input type="submit" value="car panel" /></p>
</form>

我尝试过:

           <form action="#" th:action="@{/cars:"${car.id}"}" method="get">

但不幸的是它不起作用。如何传递该值?

以下是它在网站上的显示方式: page

最佳答案

Thymeleaf 的页面 Standard URL Syntax有这样的例子:

<form action="#" th:action="@{/cars:{id}(id=${car.id})}" method="get">

关于java - 来自 :text nested in th:action in thymeleaf 的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60756954/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com