Struts2 RedirectAction问题

时间:2018-10-17 11:38:19

标签: java spring struts2 struts struts-1

嗨,我正在尝试使用result并在struts.xml中键入重定向到Struts 2.3.35中的某些动作,但是在重定向到Page时它工作正常,但是正在发生奇怪的事情,但在重定向到Action时它正在重定向到某些不同的东西网址。

下面是我的struts.XML

<constant name="struts.devMode" value="true" />
<constant name="struts.action.excludePattern"
    value="/StreamDisplayServlet,/*.view" />
<package name="default" namespace="/" extends="struts1-default">

    <interceptors>
        <interceptor name="LogonForm"
            class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor">
            <param name="className">com.org.test.LogonForm</param>
            <param name="name">LogonForm</param>
            <param name="scope">request</param>
        </interceptor>

        <interceptor-stack name="web">
            <interceptor-ref name="staticParams" />
            <interceptor-ref name="modelDriven" />
            <interceptor-ref name="basicStack" />
        </interceptor-stack>
        <interceptor-stack name="logonInt">
            <interceptor-ref name="LogonForm" />
            <interceptor-ref name="web" />
        </interceptor-stack>
    </interceptors>

    <action name="welcome">
        <result>index.jsp</result>
    </action>
    <action name="">
        <result>/index.jsp</result>
    </action>

    <action name="logon"
        class="org.apache.struts2.s1.Struts1Action">
        <param name="className">com.org.test.LogonAction</param>
        <interceptor-ref name="logonInt" />
        <result name="success">/branchSearch.view</result>
        <result name="error">/logon.logonView</result>
        <result name="branchSearch">/branchSearch.view</result>
        <result name="homePageAction" type="redirectAction">homePageAction</result>
    </action>

    <action name="logonError">
        <result>/logon.logonView</result>
    </action>

    <action name="homePageAction"
        class="org.apache.struts2.s1.Struts1Action">
        <param name="className">com.org.test.HomePageAction</param>
        <interceptor-ref name="web" />
        <result name="success">/homePage.view</result>
        <result name="error">/index.jsp</result>
    </action>

    <action name="start"
        class="org.apache.struts2.s1.Struts1Action">
        <param name="className">com.org.test.StartAction</param>
        <interceptor-ref name="web" />
        <result>/index.jsp</result>
    </action>

    <!-- <action name="branchSearch"> <result>/branchSearch.view</result> </action> -->


</package>

因此,当结果类型为branchSearch时,它工作正常,但当其为homePageAction时,它将重定向到URL http://example.com/homePageAction!example.com.action#example.com 而原始网址是http://example1.com,它应该已经重定向到http://example1.com/homePageAction.action

我不明白为什么会有“!”网址中显示“#”。

0 个答案:

没有答案