sitemesh排除装饰action的心得
sitemesh装饰模式的强大就不用说了,但使用过程中遇到的最郁闷的莫过于排除装饰action的困扰了,例如使用某个ajax请求要求返回不装饰的数据,但sitemesh却死活给你装饰了,以前用了个小技巧绕过了sitemesh的装饰--在返回的头部声明为xml类型:ServletActionContext.getResponse().setContentType("text/xml;charset=utf-8");
看了文档知道sitemesh默认装饰所有text/html的页面的,要装饰其他类型的页面还得自己配置。
但是总觉得这样很麻烦,况且有些页面是对外公开的api页面,只需要显示内容给其他iframe嵌入,这个时候如何排除呢?
在excludes里面排除的却总是不起作用!
经过查阅文档和不断的实践终于发现无法排除的原因了,原来排除的是相对于url目录层次的,而非文件所在的目录!
<!-- 在excludes元素下指定的页面将不会由SiteMesh来装饰 -->
<excludes>
<pattern>/index.jsp</pattern>
<pattern>/scripts/*.*</pattern>
<pattern>/htmleditor/*.*</pattern>
<pattern>/chart/*.*</pattern>//排除chart目录下的所有action请求
<pattern>/flash/*.*</pattern>
<pattern>/other/*.*</pattern>
<pattern>/remote_requst.action*</pattern>//排除根目录下的remote_requst.action包括带参数的请求,如果action后面不带*则只能排除不带参数的请求
</excludes>
<decorator name="global" page="global.ftl">
<pattern>*.action</pattern>
</decorator>
<decorator name="editor" page="blog.ftl" webapp="/editor/">
<pattern>/editor/*.action</pattern>
</decorator>
<decorator name="browser" page="blog.ftl" webapp="/browser/">
<pattern>/browser/*.action</pattern>
</decorator>
<decorator name="admin" page="admin.ftl" webapp="/admin/">
<pattern>/admin/*.action</pattern>
</decorator>
参考:http://coos.group.iteye.com/group/wiki/1802-action-to-exclude-sitemesh-decoration-tips
sitemesh排除装饰action的心得相关推荐
- 用sitemesh来装饰动态的左侧菜单和内容部分
sitemmesh是一个页面装饰框架,利用它可以很简单的对整个系统进行统一架构装饰,比如一个应用系统的web层可能就是top+left+content+footer四个部分组成(下图) 使用sitem ...
- Sitemesh排除Exclude不装饰特定页面的解决办法
有时候项目中有些文件不需要Sitemesh装饰,例如Error.htm, Error.jsp, OnlineHelp.htm等等.但是用Sitemesh的Exclude不管用,用Printable也不 ...
- 使用 sitemesh/decorator装饰器装饰jsp页面(原理及详细配置)
摘要:首先这个Decorator解释一下这个单词:"装饰器",我觉得其实可以这样理解,他就像我们用到的Frame,他把每个页面共有的东西提炼了出来,也可能我们也会用各种各样的inc ...
- weblogic与sitemesh乱码问题
为什么80%的码农都做不了架构师?>>> 问题描述:将应用部署到weblogic后,只要经过sitemesh装饰过的页面都出现乱码,而不经过sitemesh装饰的页面都正常显示 ...
- SiteMesh学习入门
http://www.java3z.com/cwbwebhome/article/article2/2962.html?id=1668 demo下载 简介: sitemesh应用Decorat ...
- Spring Security中文文档
Spring Security中文文档 来源:https://www.springcloud.cc/spring-security.html#overall-architecture 作者 Ben A ...
- 【汇总】ThinkPHP6入门手册
阿里云SMS发送短信验证码 - PHP接入手机验证码服务 - ThinkPHP6 https://blog.csdn.net/qq285744011/article/details/127798837 ...
- decorators.xml的用法 (转)
from :https://www.cnblogs.com/zhangxiaopeng/p/5442776.html decorators.xml的用法 (转) spring,hibernate框架做 ...
- Java项目:在线博客问答系统(java+Springboot+jsp+maven+mysql)
文章目录 前言 一.框架介绍 1.1.Spring 1.2.SpringMVC 1.3.MyBatis 1.4.SSM整合 二.开发环境 三.系统功能 3.1 文章列表 3.2 点赞评论 3.3 在线 ...
最新文章
- Html,Css,Javascript是什么?
- 【剑指offer-Java版】36数组中的逆序对
- linux 下进入oracle,linux 下的oracle怎么启动
- 梯度方向直方图和物体检测Histogram of Oriented Gradients and Object Detection
- java虚拟机通俗_JAVA虚拟机的通俗解释
- Queue Explorer过期处理
- c++语句switch语句_错误:案例标签不在C中的switch语句内
- linux里临时设置hbase参数,在centos下配置hbase环境并简单使用hbase shell
- 用python二重循环求成绩表_python的循环
- c++ primer plus 内存模型和名称空间
- ubuntu部署django详细教程
- 干净虚拟机(centos 6.4)上从头到尾安装并调试Mdrill(二)
- 软件测试 之Web项目实战解析(附全套实战项目教程+视频+源码)
- MATLAB画qpsk的矢量图,matlab仿真QPSK.doc
- c语言健康指数,C-AHI——中国汽车健康指数
- 建筑企业资质分立风险
- Python数据处理工具——Pandas
- HTML超好看樱花飘落404页面源码+带时间
- 家庭版取消灰色勾选加密内容以便保护数据的方法
- 利用CSS调整图片大小
热门文章
- 使用cpau.exe让不是管理员的用户也有权限运行哪些需要管理员权限的软件。
- 使用JSON替代XML
- python数学库的使用方法_浅谈numpy库的常用基本操作方法
- scratch学习_学习scratch编程能学到什么?对孩子有帮助吗?
- Go 语言编程 — 高级数据类型 — 指针
- 5G NGC — UDM 统一数据管理
- Spring-boot国际化
- 假设写一段代码引导PC开机这段代码是 ? Here is a tiny quot;OSquot; :-D
- F5荣获网络优化类别年度最佳HP AllianceOne合作伙伴奖项
- rhel6.0配置rsyslog传送日志到远程主机