com.opensymphony.module.sitemesh.filter.PageFilter 装饰页面
1、web.xml中配置:
<filter>
<filter-name>sitemeshFilter</filter-name>
<filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>sitemeshFilter</filter-name>
<url-pattern>/a/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>sitemeshFilter</filter-name>
<url-pattern>/f/*</url-pattern>
</filter-mapping>
2、并列web.xml新建文件decorators.xml:
<?xml version="1.0" encoding="UTF-8"?>
<decorators defaultdir="/WEB-INF/views"> <!-- 默认装饰页面, 在需要装饰的页面增加<meta name="decorator" content="default"/> -->
<decorator name="blank" page="layouts/blank.jsp" />
<decorator name="default" page="layouts/default.jsp" /> </decorators>
3、在需要装饰的页面增加<meta name="decorator" content="default"/>
相当于占位符;
4、default.jsp内容:
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib prefix="sitemesh" uri="http://www.opensymphony.com/sitemesh/decorator" %>
<!DOCTYPE html>
<html style="overflow-x:auto;overflow-y:auto;">
<head>
<title><sitemesh:title/></title>
<%@include file="/WEB-INF/views/include/head.jsp" %>
<!-- Baidu tongji analytics --><script>var _hmt=_hmt||[];(function(){var hm=document.createElement("script");hm.src="//hm.baidu.com/hm.js?82116c626a8d504a5c0675073362ef6f";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(hm,s);})();</script>
<sitemesh:head/>
</head>
<body>
<sitemesh:body/>
<script type="text/javascript">//<!-- 无框架时,左上角显示菜单图标按钮。
if(!(self.frameElement && self.frameElement.tagName=="IFRAME")){
//$("body").prepend("<i id=\"btnMenu\" class=\"icon-th-list\" style=\"cursor:pointer;float:right;margin:10px;\"></i><div id=\"menuContent\"></div>");
//$("#btnMenu").click(function(){
//top.$.jBox('get:${ctx}/sys/menu/treeselect;JSESSIONID=<shiro:principal property="sessionid"/>', {title:'选择菜单', buttons:{'关闭':true}, width:300, height: 350, top:10});
//if ($("#menuContent").html()==""){$.get("${ctx}/sys/menu/treeselect", function(data){$("#menuContent").html(data);});}else{$("#menuContent").toggle(100);}
//});
}//-->
</script>
</body>
</html>
com.opensymphony.module.sitemesh.filter.PageFilter 装饰页面的更多相关文章
- sitemesh 2.4 装饰器学习
SiteMesh 是一个网页布局和修饰的框架,利用它可以将网页的内容和页面结构分离,以达到页面结构共享的目的 SiteMesh是OpenSymphony团队开发的JEE框架之一,它是一个非常优秀的页面 ...
- 解决sitemesh3装饰页面不能使用freemarker标签问题
如题,这个问题其实在sitemesh2中已经很好的解决了,不过在sitemesh3中可能没有解决,所以要自己写代码解决了,下面我先讲下sitemesh2是如何解决的: <servlet> ...
- 装饰页面decorators.xml
WEB-INF/decorators.xml 这个配置可以增加页面的 装饰页面
- 过滤器Filter(拦截jsp页面的跳转)案例:
创建一个 Filter , class类: 其继承于 接口 Filte(接口导包:import javax.servlet.Filter;) 在 web.xml 文件中配置并映射该 Filter. 其 ...
- 借助 Filter 生成静态页面缓存问题
如果有些 jsp 页面,在一次 jsp 页面生成后 html 后, 就不太可能需要更新.可以使用缓存机制来解决这个问题. 解决思路如下 1. 定义一个文件夹 pagestaticize,用来存放 j ...
- decorator 装饰页面,根据不同设备自动切换移动和pc站
package com.thinkgem.jeesite.modules.sys.interceptor; import javax.servlet.http.HttpServletRequest; ...
- Filter中实现页面转发
在过滤器中实现页面转发时,报错 java.lang.IllegalStateException:Cannot forward after response has been committed 转发代 ...
- SiteMesh:一个优于Apache Tiles的Web页面布局、装饰框架
一.SiteMesh项目简介 OS(OpenSymphony)的SiteMesh是一个用来在JSP中实现页面布局和装饰(layout and decoration)的框架组件,能够帮助网站开发人员较容 ...
- Spring MVC学习笔记——SiteMesh的使用(转)
转自 SiteMesh的使用 SiteMesh的介绍就不多说了,主要是用来统一页面风格,减少重复编码的. 它定义了一个过滤器,然后把页面都加上统一的头部和底部. 需要先在WEB-INF/lib下引入s ...
随机推荐
- Unity3D ShaderLab 使用渐变纹理着色
Unity3D ShaderLab 使用渐变纹理着色 在我们编写着色器的过程中,还可以通过渐变纹理来控制漫反射的光照颜色.这种做法同样在VALVE的军团要塞2中及其流行. 前期,请准备一个渐变色的图片 ...
- magento二次开发的基本步骤分享
Magento后台添加新模块的体会 确定命名空间(Namespace)和模块(Modulename)的命名: 在app/etc/modules/ 路径下,创建 Namespace_Modulename ...
- Codis 集群搭建
Codis 集群搭建 1 安装go1.3.1 CentOS 7.0 安装go 1.3.1 1.1 下载go安装包 golang中国上下载 下载到Downloads下 1.2 解压 tar -zxf g ...
- Day02_JAVA语言基础第二天
1.常量(理解) 1.概念 在程序运行过程中,其值不会发生改变的量 2.分类(掌握) A .字面值常量 整数常量:1,2,-3 小数常量:2.3,-232.3 字符常量:'A' 字符串 ...
- wxPython
wxPython是python GUI的工具箱. 一, 安装 http://wiki.wxpython.org/How%20to%20install%20wxPython 稳定的wxpython 需要 ...
- UVa 10747 - Maximum Subsequence
题目大意:给出n个数,从中选取k个,使得乘积最大,并且尽量使和最大 分析:首先按照数的绝对值大小排序.然后就要分三大类情况讨论: (1)前k个中选到0:如果选到0的话,乘积一定是0,所以尽量选大的数, ...
- 1130-host ... is not allowed to connect to this MySql server 开放mysql远程连接 不使用localhost
报错:1130-host ... is not allowed to connect to this MySql server 解决方法: 1. 改表法. 可能是你的帐号不允许从远程登陆,只能在loc ...
- 正则表达式中参数g、i、m的作用(share)
参数 g g 只影响于 exec.match 方法. 若不指定 g,则:每次调用 exec 都只返回第一个匹配:match 也是只返回第一个匹配. 若指定 g,则:每次调用 exec 都从上一个匹配之 ...
- box2dweb 学习笔记--sample讲解
前言: 之前博文"台球游戏的核心算法和AI(1)" 中, 提到过想用HTML5+Box2d来编写实现一个台球游戏. 以此来对比感慨一下游戏物理引擎的巨大威力. 做为H5+box2d ...
- ZMMR107-批量更改PO经价值
************************************************************************ Title : ZMMR107 ** Applicat ...