struts-1 - Struts 1 操作从 struts-config 转发到另一个 struts-config 文件中的另一个操作

标签 struts-1 forward struts-config struts-action

我正在尝试从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" />

注释: “WEBR​​OOT_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/

相关文章:

java - 注销后返回时验证用户

java - 如何访问Action或dispatch action类中action标签(struts-config.xml)的path属性?

java - 如何检查某个 URL 是否可以从 PC 访问?

c++ - 通用引用和本地类

java - struts Action 映射 Action 输入属性

java - 将日期格式化为字符串,从 bean 到 javascript

php - $this->forward 丢失了用户的请求路由?

php - 将 www.foo.com 重定向到 www.bar.com

forms - 这是 session 范围或请求范围内的 struts 1.x 表单 bean 吗?