1、问题:被修饰页面的body区被“干掉”了。。。取而代之的是修饰页面的body,而那里面我不可能写onload方法..所以..什么都没有了。
解决:把onload方法写到body区。
2、我通过xmlhttp向后台发出request,servlet使用out.println()返回我所需要的xmldom,这一切都没有问题。
但当我加入sitemesh之后,我无法再接受到我需要的xmldom了。当然,我想这是sitemesh自己的filter中的因为使用了getWriter()而冲掉了我的输出流。
因此我试图通过在decorators.xml中配置exculde的方式来保护我需要进行xmlhttp请求的包,比如 /list/template/*.jsp。
结果这种尝试也失败了。我很困惑,不知道有没有人对于使用xmlhttp的页面进行过sitemesh的修饰?遇到这种输出流被冲掉的问题如何解决?
解决:
a.在默认设置下,sitemesh只会parse html类型的response:
<parser content-type="text/html" class="com.opensymphony.module.sitemesh.parser.FastPageParser" />
这样就不会有任何问题了。
b.用一个标签包装回传的数据,给标签一个ID="ID",xmlhttp得到返回的数据塞入页面一个隐藏的div,然后采用getElementById('ID'),取得要使用的数据
3、使用了SiteMesh出现了乱码
,在装饰页面和被装饰页面都加了<%@ page contentType=
"text/html; CHARSET=utf8"
pageEncoding=
"GBK"
%>
解决:
对这个乱码问题做了好多尝试,虽然没有彻底解决,但也找到一个暂时的办法。
我发现对静态页面装饰的话,不论怎么设置编码都是乱码。对动态页面可以设置
<%@ page contentType="text/html; CHARSET=utf8" pageEncoding="GBK"%>就不会是乱码了。我只好把html页面全换成jsp页面并加上上面那一句。
分享到:
相关推荐
sitemesh-2.4.2-src.jar 是sitemesh的源文件jar包,当调试时需要选择该jar包进行资源查找,很好用的页面架构工具
struts2-sitemesh-plugin-2.0.8.jar
sitemesh-3.0-alpha-2.jar
struts2-sitemesh-plugin-2.1.8.1.jar
SiteMesh is a web-page layout and decoration framework and web- application integration framework to aid in creating sites consisting of many pages for which a consistent look/feel, navigation and ...
sitemesh-2.2.1.jarsitemesh-2.2.1.jarsitemesh-2.2.1.jar
用于在SSH2工程中使用sitemesh-2.4.jar 包;
struts2-sitemesh-plugin-2.2.1.1.jarstruts2
sitemesh-2.2.1.jar
sitemesh-2.4.1.jar sitemesh-2.4.1.jar sitemesh-2.4.1.jar sitemesh-2.4.1.jar sitemesh-2.4.1.jar sitemesh-2.4.1.jar
sitemesh-2.2.1.rar sitemesh-2.2.1.rar sitemesh-2.2.1.rar
struts2-sitemesh-plugin-2.1.6.jar
sitemesh-2.3.jar
SiteMesh-SpringMVC-Mybatis
解决 java.lang.NoSuchFieldException: DEFAULT_PARAM>问题,下载后替换即可。
sitemesh-3.0.0的库和源码;从官网(https://github.com/sitemesh/sitemesh3)上下载的!
sitemesh-2.4.0.jar
sitemesh-2.3.zip
sitemesh-2.4.zip
struts2sitemesh-freemarker 源码