小弟用SSI开发Demo工程,遇到全局异常不跳转的问题,各位大虾帮忙看看是神马问题:
struts.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd"><struts>
   <!-- 公共配置信息 -->
<package name="common" extends="json-default">
<interceptors>
<interceptor name="authority" class="com.greenbird.bbs.common.interceptor.AuthorityInterceptor">
</interceptor>
<interceptor-stack name="myStack">
<interceptor-ref name="authority" />
<interceptor-ref name="timer"/>
<interceptor-ref name="params"/>
<interceptor-ref name="defaultStack" />
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="myStack" />
     <!-- 全局跳转页面-->
     <global-results>
<result name="RoleError">/pages/error/roleError.jsp</result>
<result name="Login">/index.jsp</result>
<result name="Error" type="redirect">/error.html</result>
</global-results>
<!-- 全局异常跳转 -->
<global-exception-mappings>
<exception-mapping result="Error" exception="com.greenbird.bbs.common.exception.BaseException"/>
<exception-mapping result="Error" exception="java.lang.Exception"/>
</global-exception-mappings>
    </package>
   <!-- ========== include struts XML  ================================== -->
<include file="struts/*/*-config.xml" />
</struts>登录后,地址栏输入一个不存在的action请求路径,应该跳转到错误页面的,可是结果却是404,找不到页面,页面路径是对的这是什么问题

解决方案 »

  1.   

    这样配置应该只是当系统抛出Exception异常时,才会转到Error的结果吧。
      

  2.   

    输入不存在的路径当然是报404错误,你这样写是只有java抛异常的时候才回指向/error.html页面,如果你想404错误也指向一个页面的话要在web.xml中设置,解决办法如下:
      

  3.   


    配过了
      <error-page>
       <error-code>404</error-code>
       <location>/error.html</location>
      </error-page>
      <error-page>
       <error-code>400</error-code>
       <location>/error.html</location>
      </error-page>
      <error-page>
       <error-code>500</error-code>
       <location>/error.html</location>
      </error-page>
      

  4.   

    找到原因了:自定义的404页面大小必须大于512字节,否则Internet Explorer会认为你自定义的404页面不够权威,Internet Explorer会使用其自带的404页面代替
    http://www.ludou.org/why-custom-404-not-show-in-internet-explorer.html