2012-09-04 63 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')}">