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 ...
随机推荐
- 【转】Fiddler 教程
原文转自:http://www.cnblogs.com/tankxiao/archive/2012/02/06/2337728.html Fiddler是最强大最好用的Web调试工具之一,它能记录所有 ...
- flex+java实现文件的上传
flex前端代码: <?xml version="1.0" encoding="utf-8"?><s:BorderContainer xmln ...
- linxu c语言 fcntl函数和flock函数区别 【转】
flock和fcntl都有锁的功能,但他们还有一点小小的区别: 1.flock只能加全局锁,fcntl可以加全局锁也可以加局部锁. 2.当一个进程用flock给一个文件加锁时,用另一个进程再给这个文件 ...
- AttributeError: 'dict_values' object has no attribute 'translate'
/***************************************************************************************** * Attribu ...
- bind 方法实现
[要求]:实现 bind 方法 [实现]: // 简单方法 Function.prototype.bind = Function.prototpe.bind || function(context) ...
- Day09_面向对象第四天
1.多态的概念和前提(掌握) 1.概念-什么是多态(掌握) 对象在不同时刻表现出来的不同状态. 2.针对引用类型的理解 编译期间状态和运行期间状态不一样 比如 ...
- autoproxy 规则
目前在 gfwList 中,有如下的规则格式: example.com 匹配:http://www.example.com/foo匹配:http://www.google.com/search?q=w ...
- CentOS终端界面登入Linux
上述图片中,前两行为CentOS的版本信息,其内容来自于/etc/issue这个档案中. 后三行:www login:其中www表示主机名(设主机名为www.vbird.tsal),主机名显示通常只取 ...
- dede取子栏目时重复显示同级栏目的终极解决方法
使用channelartlist标签时,当栏目没有子栏目是,会出现重复同级栏目的问题,解决方法如下: 先看下面的代码{dede:channelartlist typeid='2'} {dede:ty ...
- UVa 442 矩阵链乘(栈)
Input Specification Input consists of two parts: a list of matrices and a list of expressions. The f ...