我正在尝试在网络系统上应用装饰器,第一步我尝试仅将它应用于一个页面。以下是我的配置
web.xml
<filter>
<filter-name>sitemesh</filter-name>
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>sitemesh</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
装饰器.xml
<decorators defaultdir="/WEB-INF/decorators">
<decorator name="default" page="default.jsp">
<pattern>/combinepredata*</pattern>
</decorator>
</decorators>
一切似乎都很好,因为一个页面使用页眉/页脚等正确呈现,而其他页面由于我在 decorator.xml
上应用的模式而没有装饰。但是,每次我尝试加载一页 Regex.htm
时,都会出现如下错误
ERR_CONTENT_LENGTH_MISMATCH
奇怪的是,问题仅出现在该特定页面上,而系统中的其余页面工作正常。如果我将以下内容添加到 decorator.xml
<excludes>
<pattern>/Regex*</pattern>
</excludes>
更新
我尝试过以下浏览器
- Chrome 36.0.1985.125 m > 错误
- IE8 > 没有错误
- Firefox 30 > 无错误
对于 IE8 和 Firefox 30,页面均已正确加载,但比在 decorator.xml
中排除页面后加载所需的时间更长
我的问题是为什么上述错误只发生在该页面上?为什么我需要排除它才能使其正常工作?
最佳答案
将这一行添加到 JSP 后,它就可以工作了
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
关于javascript - Sitemesh 出现 ERR_CONTENT_LENGTH_MISMATCH 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24816879/