转发到struts2中同一servlet容器中另一个应用程序中的操作

转发到struts2中同一servlet容器中另一个应用程序中的操作,struts2,forward,Struts2,Forward,我试图将控件从应用程序A中的另一个操作类转发到应用程序B中的一个操作类。两个应用程序都在同一个servlet容器中运行。以下是我编写的代码: RequestDispatcher rd = ServletActionContext.getServletContext().getContext("/App2").getRequestDispatcher("/newApp.action"); HttpServletRequest request = ServletActionConte

我试图将控件从应用程序A中的另一个操作类转发到应用程序B中的一个操作类。两个应用程序都在同一个servlet容器中运行。以下是我编写的代码:

    RequestDispatcher rd = ServletActionContext.getServletContext().getContext("/App2").getRequestDispatcher("/newApp.action");
    HttpServletRequest request = ServletActionContext.getRequest();
    request.getSession().setAttribute("commonQuestions", answers);
    HttpServletResponse response = ServletActionContext.getResponse();
    rd.forward(request, response);
    return null;

它返回404资源未找到错误。当然,同一代码稍加修改即可访问同一应用程序1中的操作。我在这里做错了什么?。提前谢谢

我认为您可能需要调整应用服务器的安全性,您使用的是什么服务器?前进?!您不转发到其他应用程序,而是重定向。404-Resource not found表示应用程序A中没有此类资源。Web应用程序彼此隔离运行,因此您无法执行此操作。>>四元数>>这是glassfish 2.1服务器,运行在我的本地桌面上。我看不到任何安全问题。>>Dave Newton>>您可以转发到其他应用程序。