Frage

I would like to use Spring theme resolvers' feature (see: here) in my Thymeleaf template.

What is the Thymeleaf's equivalent to the spring:theme JSP tag?

See JSP code sample below:

<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<html>
   <head>
      <link rel="stylesheet" href="<spring:theme code='styleSheet'/>" type="text/css"/>
   </head>
   <body style="background=<spring:theme code='background'/>">
      ...
   </body>
</html>
War es hilfreich?

Lösung

I don't think this was the case at the time that you asked your question, but the current version of thymeleaf-spring3 (2.0.18 as of this writing) has as part of the SpringStandard dialect a themes function, which can be used like this:

<body th:style="'background-color: ' + ${#themes.code('backgroundColor')}">
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top