论坛首页 Java版 Webwork

用sitemesh处理404页面的问题

浏览 3130 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
最后更新时间:2005-01-30
我在用sitemesh处理page not found(404)页面的时候,发现并不能得到预期的效果,
404.jsp并不能被sitemesh装饰!

可能sitemesh装饰页面的原理是用filter,而filter对转发的请求不处理的情况,以致sitemesh不能装饰404.jsp?????

望有识之士指点一下!

web.xml有关配置

    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>


<error-page>
    <error-code>404</error-code>
    <location>/errors/404.html</location>
</error-page>
   
最后更新时间:2005-01-31
贴上你的decorators.xml内容
   
0 请登录后投票
最后更新时间:2005-01-31
<?xml version="1.0" encoding="iso-8859-1"?>

<decorators defaultdir="/decorators">
<decorator name="main" page="main.jsp">
<pattern>*</pattern>
</decorator>
</decorators>

有劳楼上的大哥了!
   
0 请登录后投票
最后更新时间:2005-01-31
配置正确,莫非你用的是Tomcat 5?

http://www.opensymphony.com/sitemesh/faq.html 写道

How do I enable SiteMesh to decorate error pages on Tomcat 5?
Replace the <filter-mapping> element in web.xml with this:

<filter-mapping>
    <filter-name>sitemesh</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
</filter-mapping>
   
0 请登录后投票
最后更新时间:2005-01-31
非常感谢,但是还是如原来那样不能装饰
我在tomcat4,和5都试过了,不行啊,

   
0 请登录后投票
最后更新时间:2005-01-31
不知道了,去sitemesh的mail list上问吧

或者你也可以在404.html里面用javascript做一个重定向,定向到可以被修饰页面即可。
   
0 请登录后投票
最后更新时间:2005-01-31
Readonly 写道
配置正确,莫非你用的是Tomcat 5?

http://www.opensymphony.com/sitemesh/faq.html 写道

How do I enable SiteMesh to decorate error pages on Tomcat 5?
Replace the <filter-mapping> element in web.xml with this:

<filter-mapping>
    <filter-name>sitemesh</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
</filter-mapping>


加上<dispatcher>ERROR</dispatcher>,试试
   
0 请登录后投票
最后更新时间:2005-01-31

加了<dispatcher>ERROR</dispatcher>还是不行

下下选择只能在404.html下用JS做重定向了,

谢谢各位,
还有个小问题
为什么在ww设置了
webwork.locale=en_US
webwork.i18n.encoding=ISO-8859-1
运行时访问页面
<ww:text name="default.title" />怎么还是默认为zh_CN,而不是en_US?
好像设定上面两项都没用处,WW主页上说2.1.7修正了这个问题,但我下了试验还是一样,真郁闷!
   
0 请登录后投票
最后更新时间:2005-02-01
spring嘟嘟 写道

如果存在zh_CN的资源文件就读zh_CN了

按照客户机的区域来的


但我把ww应用装在e文版的linux下,客户机是中文环境,出来的却是en_US,
除非overwite ActionSupport的 getLocale();在getLocale()返回根据客户端locale!
所以我才有这个疑问
   
0 请登录后投票
论坛首页 Java版 Webwork

跳转论坛:
JavaEye推荐