Struts 2.0页面导航

时间:2009-12-30 10:38:45

标签: struts2

情况是这样的。第1页,第2页,第3页有三页

场合

第1页>>采取>>第2页>>采取>>第3页

第2页是一个中间页面,其中包含链接和链接,其中包含操作到达page3所需的参数。

<a href="<s:url action="gotoPage3" includeParams="none">
    <s:param name="request.accountId"><s:property value="#parameters['accountFrom.accountId']"/></s:param>
    <s:param name="request.accountFromId"><s:property value="#parameters['accountFrom.accountId']"/></s:param>
</a>

我现在想要什么

我想摆脱第2页,以便

page1&gt;&gt;采取&gt;&gt;第3页

我做了什么

在struts配置中,我给出了与page1关联的动作结果,以链接与page2链接相关联的动作。

<action name="processPage1AndGoToPage3" class="dominos" method="processPage1AndGoToPage3">
    <interceptor-ref name="out-of-office-interceptor"/>
    <interceptor-ref name="paramsPrepareParamsStack"/>
    <interceptor-ref name="remove-hibernate-filters-interceptor"/>
    <interceptor-ref name="request-deleted-interceptor"/>
    <result name="success" type="chain">gotopage3</result>
</action>

问题

现在我如何将params传递给与page2关联的动作(将您带到第3页)。 (我之前通过链接传递了它们)

任何指针都会有帮助

1 个答案:

答案 0 :(得分:2)

<action name="processPage1AndGoToPage3" class="dominos" method="processPage1AndGoToPage3">
    <interceptor-ref name="out-of-office-interceptor"/>
    <interceptor-ref name="paramsPrepareParamsStack"/>
    <interceptor-ref name="remove-hibernate-filters-interceptor"/>
    <interceptor-ref name="request-deleted-interceptor"/>
    <result name="success" type="chain">gotopage3</result>
    <s:param name="page2Param1" value="page2Value1"/>
    <s:param name="page2Param2" value="page2Value2"/>
</action>

请注意, page2Param1 page2Param2 将以与调用http://server/webapp/processPage1AndGoToPage3.action?page2Param1=page2Value1&page2Param2=page2Value2相同的方式传递给 processPage1AndGoToPage3