加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

通过Thymeleaf模板使用Spring的主题解析器和主题

发布时间:2020-12-15 01:21:44 所属栏目:大数据 来源:网络整理
导读:我想在Thymeleaf模板中使用Spring主题解析器的功能(请参阅:here). Thymeleaf与spring:theme JSP标签等效吗? 请参见下面的JSP代码示例: %@ taglib prefix="spring" uri="http://www.springframework.org/tags"%html head link rel="stylesheet" href="spr

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

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>
最佳答案
我不认为在您提出问题时就是这种情况,但是当前版本的thymeleaf-spring3(撰写本文时为2.0.18)作为SpringStandard dialect a主题功能的一部分,可以像这个:

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读