2012-09-04 59 views
3

我想在我的Thymeleaf模板中使用Spring主题解析器的功能(请参阅:here)。使用Spring的主题解析器和主题与Thymeleaf模板

什么是Thymeleaf相当于spring:theme JSP标签?

下面

见JSP代码示例:

<%@ 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> 

回答

2

我不认为这是在那个你问你的问题的时间的情况下,但目前的版本thymeleaf-spring3的(2.0.18作为本文)作为SpringStandard dialect的一部分具有主题功能,其可以像这样使用:

<body th:style="'background-color: ' + ${#themes.code('backgroundColor')}">