我在action类中
try{
...
    }catch(Exception ex){
     return ERROR;  
    }
struts.xml
  <global-results>  
    <result name="error">/error.jsp</result>  
  </global-results>
,但是为什么没有转发到error.jsp页面呢?

解决方案 »

  1.   


    看看你的
    <global-results>    
            <result   name= "error "> /error.jsp </result>    
        </global-results>
    是不是和你的action放在同一个package(struts.xml的package标签)内,我估计你出现这问题是因为2者是不在一个package内造成的<package name="default" extends="struts-default">
    <global-results>
         <global-results>    
            <result   name= "error "> /error.jsp </result>    
         </global-results> 
        //这里写你的action的映射,这样多个action可以共用一个result了
    </package>
      

  2.   

    <global-results>
        <result name="login" type="redirect">index.jsp</result>
    </global-results>
      

  3.   

    这个问题很简单!你只需要把<global-results>放在默认的名称空间的<package>中就可以了哦!所谓的默认的名称空间就是package中的namespace为空的包。