I have this block of code Thymeleaf calls the Spring context and pulls in the user id.
<li {#ctx.httpSession} >
<span th:object="${session.user}"> </span>
<span><p>Surname: <span th:text="*{user.id}">Pepper</span></p></span>
I would like to place it into a existing th:replace listed item. Basically i need to get the static 2 replaced with a current session userid inside the url I have tried numerous options, and cant seem to find a solution online.
This is one of my attempts
<li sec:authorize="isAuthenticated()" {#ctx.httpSession}, th:object="${session.user}" th:replace="::menuItem ( '/users/'+*{user.id}+'/coworkers/find','coworkers','find coworkers','search','Find coworkers')"><span>Find Coworkers</span>
</li>
This is the orginial
<li sec:authorize="isAuthenticated()" th:replace="::menuItem ( '/users/2/coworkers/find','coworkers','find coworkers','search','Find coworkers')">
I am a Thymeleaf novice so any help is greatly appreciated, thank you.
Have tried {*{user.id}}
Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "user.id" (template: "fragments/layout" - line 65, col 106)