springMVC-主题

来源:互联网 发布:c语言编译程序的软件 编辑:程序博客网 时间:2024/04/28 14:18

使用springMVC完成多主题切换功能

1.springMVC.xml

<!-- theme解析器 --><bean id="themeChangeInterceptor"class="org.springframework.web.servlet.theme.ThemeChangeInterceptor"><property name="paramName" value="themeName"></property></bean><bean id="themeSource"class="org.springframework.ui.context.support.ResourceBundleThemeSource"><property name="basenamePrefix" value="themes."></property></bean><bean id="themeResolver"class="org.springframework.web.servlet.theme.CookieThemeResolver"><property name="defaultThemeName" value="style_default" /></bean>

拦截器

<mvc:interceptors><mvc:interceptor><mvc:mapping path="/**" /><ref bean="themeChangeInterceptor" /></mvc:interceptor></mvc:interceptors>

2.项目结构


3.页面标签

<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>

<link href="<%=basePath %><spring:theme code='styleSheet'/>" rel="stylesheet" type="text/css" />

4.style.properties文件

styleSheet=common/css/style2.csshomeTreetableLayout=common/js/treetable/home_treetablelayout.csshomeTreetable=common/js/treetable/home_treetable.csscard_img_play=common/images/default/card_playorpause.pngcard_detail_deviceimp=common/images/default/card_redimp.pngcard_detail_managerimp=common/images/default/card_yellowimp.pngcard_detail_policename=common/images/default/card_police.pngcard_detail_publicsecurity=common/images/default/card_publicsecurity.pngcard_detail_devicecode=common/images/default/card_device.pngcard_detail_datetime=common/images/default/card_time.png


0 0
原创粉丝点击