不通过struts-config.xml中的forward配置,直接在action中跳转到需要的"***action.do?parms=1"呢?

解决方案 »

  1.   

    response.sendRedirect("***action.do?parms=1");
      

  2.   

    2.request.getRequestDispatcher("***action.do?parms=1").forward(request,response);
      

  3.   

    3.ActionForward af = new ActionForward("***action.do?parms=1");
      //如果需要重定向跳转,加上一句:af.setRedirect(true);
      return af;
      

  4.   

    可能是我没有讲清楚,在我使用的公司的框架里面有一个runComplete()方法,返回的ActionForward 对象在框架里已经默认是new ActionForward(“complete”)了,我现在需要的自己通过判断request.getSession().getAtrrubute("forward")的值,如果是null就跳转到默认的complete对应的路径,如果不是null就需要绕开公司的框架,同时我觉得可能还需要饶开struts框架,跳转到一个mainpage.jsp去!我现在只有重写了一个方法
    ActionForward runCompleteNew(),实现了这个功能,但是在原有的void runComplete()中如何实现呢,试过response.sendRedirect("***action.do?parms=1");不可以啊!
      

  5.   

    ActionForward af = null;
    String url=request.getSession().getAtrrubute("forward");
    if(url==null || "".equals(url)){
       af=runComplete();   
    }else{
       af= new ActionForward(url);
    }
    return af;
    这样不就可以了吗?