<global-exceptions><exception key="nullpointer" path="/error.jsp" scope="request" type="java.lang.NullPointerException"/></global-exceptions>我在struts-config.xml添加了这个全局异常问题:我在action中throw java.lang.NullPointerException这个异常的时候,没有跳转到定的页面,最终还是跳转到了action跳转的页面(该action已经执行了异常),请问各位大虾,还需要怎么样,才能正确执行该全局异常

解决方案 »

  1.   

    lz可以把你action的代码贴出来看看!
      

  2.   

    public ActionForward execute(ActionMapping actionMapping,
    ActionForm actionForm, HttpServletRequest httpServletRequest,
    HttpServletResponse httpServletResponse){
    int test = 0;
    if(test == 0)
    throw new java.lang.NullPointerException();
    return new   ActionForward(actionMapping.getInput());
    }  这是测试用,先谢谢你的回复
      

  3.   

    public ActionForward execute(ActionMapping actionMapping,
    ActionForm actionForm, HttpServletRequest httpServletRequest,
    HttpServletResponse httpServletResponse)   throws Exception{
      

  4.   

    public ActionForward execute(ActionMapping actionMapping,
    ActionForm actionForm, HttpServletRequest httpServletRequest,
    HttpServletResponse httpServletResponse)   throws Exception{System.out.println("我被调用了");
      int test = 0;
      if(test == 0) {
        System.out.println("我抛异常了");
        throw new java.lang.NullPointerException();
      }
      return new   ActionForward(actionMapping.getInput());
    }  看看能打出来吗?