I try to add a class to a navlink based on the given URI. My code is like this:
<a data-th-href="#{@{menu.news.href}}" class="nav-link" th:classappend="#{#{httpServletRequest.requestURI} == #{menu.news.href}} ? 'active' : ''">
I also tried
.... th:classappend="#{httpServletRequest.requestURI == menu.news.href} ? 'nav-link active' : ''" ....
however this evaluation always returns false and no class is added. "httpServletRequest.requestURI" and "menu.news.href" are both the same ("/web/news") and there are no whitespaces in the messages.properties.
Is there something wrong about the operator or what am I missing?