Home > front end >  Can't get thymeleaf parameter in href from model attribute
Can't get thymeleaf parameter in href from model attribute

Time:05-15

I'm new to thymeleaf. I can't get systemId in th:href ,but I can do it in <p th:text...

What's the problem? Pls, help

My code

Result

CodePudding user response:

Just replace this code <a th:href="@{|/${systemId}/releases/${release.getReleaseId()}|}"

<a th:href="@{|/${systemId}/releases/new|}" the "| |" is solution of the problem

https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html read here 4.8

CodePudding user response:

The correct syntax for your links should be:

1: th:href="@{/{id3}/releases/{id3}(id3=${release.releaseId})}"

or

1: th:href="@{/{id3}/releases/{id2}(id3=${release.releaseId}, id2=${release.releaseId})}"

(if you really want to use 2 different variables for the same value.)

2: th:href="@{/releases/new/{id}(id=${systemId})}"

  • Related