【发布时间】:2016-05-18 21:10:06
【问题描述】:
所以我尝试使用 th:href 重定向整个 url,但它添加了我不想要的字符。
我现在的网址是这个
http://localhost:8080/viewCourse/post/5
我正在尝试回溯到该帖子所属的课程,即
http://localhost:8080/viewCourse/1
所以目前这就是我的 html 的样子
<a th:href="@{'/viewCourse/'(${post.course.id})}"><span th:text="${post.course.name}"></span></a>
这是我得到的网址
http://localhost:8080/viewCourse/?1
ID 是正确的,但我不确定为什么会有 ?。
我也试过了
<a th:href="@{'/viewCourse/'(id=${post.course.id})}"><span th:text="${post.course.name}"></span></a>
这给了我这个
http://localhost:8080/viewCourse/?id=1
如果有人能看到我如何解决这个问题并告诉我,那就太好了,在此先感谢。
【问题讨论】: