我正在尝试从struts-config调用struts 1中的actionforward属性,并且我想调用另一个action,它位于另一个struts.config文件中。显然它不起作用!
我的代码是:
In "struts-misExpedientes.xml"
<action path="/s99bIrInicio" forward="$$$WEBROOT_ENVIRONMENT$$$/comunJSP/s99binicio.do">
the other xml file is "struts-comun.xml"
<action path="/s99binicio" forward="/s99bIrWelcomeMensajeDia.do" />
注释:
“WEBROOT_ENVIRONMENT”
是我在属性文件中声明的变量,其值为[http://localhost:8100/s99bEnvironmentWar]
感谢您提供的任何想法。
最佳答案
如果您的意思是要从一个 Web 应用程序转发到另一个 Web 应用程序,那么这是不可能的。每个 Web 应用程序都与其他 Web 应用程序隔离。每个都有自己的 awn 类、库和 session ,与另一个不同。因此,将 HttpRequest 对象从一个传递到另一个是没有意义的。
您可能应该重定向到其他网络应用程序。顺便说一句,Struts 不鼓励在单个 wepapp 内使用 Action 链,即使它是可能的。
编辑:看来您正在使用模块。那么做什么the documentation说:
There are three approaches for switching from one module to another.
- You can use the org.apache.struts.actions.SwitchAction from the Extras JAR,
- you can use a
<forward>
(global or local) and specify the contextRelative attribute with a value of true,- or you can specify the "module" parameter as part of any of the Struts JSP hyperlink tags (Include, Img, Link, Rewrite, or Forward).
关于struts-1 - Struts 1 操作从 struts-config 转发到另一个 struts-config 文件中的另一个操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14607214/