从 Struts2 应用调用 Struts1 操作

Call Struts1 action from Struts2 application

我们有 2 个 struts1 应用程序,早些时候我们有一个从一个应用程序到另一个应用程序的调用。

在 config.xml 中的第一个应用程序中,我们使用以下功能调用第二个应用程序,

    <forward name="inquiry" path="/inquiryaccount.do?prefix=/inquiry&amp;page=/inquiryconnect.do" redirect="false" />

    <action path="/inquiryaccount" type="org.apache.struts.actions.SwitchAction" />

我们有 inquiryconnect.do 出现在其他应用程序中 config.xml

现在我们已将一个应用程序从 struts1 迁移到 struts2。在 struts2 config.xml (struts.xml) 但我没有找到任何 SwitchAction 像 class 来调用其他 struts1行动。

我试过下面但没有用。

<result type="redirectAction">
                <param name="inquiry">inquiryconnect.do</param>
                <param name="namespace">/inquiry</param>               </result>

它给我 404。

有人可以指导我吗?

回答我自己的问题。

在Struts.xml中有一个动态结果如:

<result name="success" type="redirect">${url}</result>

在行动中:

private String url;

public String getUrl()
{
 return url;
}

public String execute()
{
     url = hostPath+"/appnametojump/actionclassname.do";         
     return "success";
}

通过使用上面的代码,我们现在可以从 Struts2.

调用 Struts1 应用程序