appfuse web.xml文件解释说明--样式主题

appfuse中web.xml的css样式配置说明:

1     <!-- Define the default CSS Theme -->
2     <context-param>
3         <param-name>theme</param-name>
4         <param-value>simplicity</param-value>
5     </context-param>

该段用于页面整体风格,appfuse对这个参数的使用如下:

  • 在/myapp/src/web/org/appfuse/webapp/listener/StartupListener.java文件中将theme值放入ServletContext
  • 在/myapp/src/web/org/appfuse/webapp/filter/LocaleFilter.java文件中将request中的theme值保存到ServletContext
 1         ServletContext context = event.getServletContext();
 2 
 3         // Orion starts Servlets before Listeners, so check if the config
 4         // object already exists
 5         Map config = (HashMap) context.getAttribute(Constants.CONFIG);
 6 
 7         if (config == null) {
 8             config = new HashMap();
 9         }
10         
11         if (context.getInitParameter("theme") != null) {
12             config.put("theme", context.getInitParameter("theme"));
13         }
View Code
1         String theme = request.getParameter("theme");
2         if (theme != null && request.isUserInRole(Constants.ADMIN_ROLE)) {
3             Map config = (Map) getServletContext().getAttribute(Constants.CONFIG);
4             config.put("theme", theme);
5         }
View Code
  • 页面根据theme值加载css文件
1         <link rel="stylesheet" type="text/css" media="all" href="<c:url value='/styles/${appConfig["theme"]}/theme.css'/>" />
2         <link rel="stylesheet" type="text/css" media="print" href="<c:url value='/styles/${appConfig["theme"]}/print.css'/>" />
View Code

 

转载于:https://www.cnblogs.com/easydo/p/3277652.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值