簡體   English   中英

Struts 1.3動作轉發參數

[英]Struts 1.3 action forward parameter

我正在開發一個使用Struts 1.3的小項目,我遇到了以下問題。

Action發生一些業務邏輯后,我想將控件轉發給另一個在struts-config.xml映射的Action。

通常這是我解決這個問題的方式:

struts-config.xml中

<action path="/boardCreate" type="com.example.BoardCreateAction" name="BoardCreateForm" input="/board.jsp">
    <forward name="success" path="/board.do" redirect="true" />
</action>

Java動作類

return mapping.findForward("success");

這將重定向到board.do動作,該動作也映射到那里。

我的問題是我想將控件重定向到:

<forward name="success" path="/board.do?id=1" redirect="true" />

注意id = 1參數。 除了重建我自己的行動之外,這是否還有其他任何方式? 我找不到任何辯論此事的文件。 謝謝!

ActionRedirect redirect = new ActionRedirect(mapping.findForward("success"));
redirect.addParameter("id", theId);
return redirect;

http://tool.oschina.net/uploads/apidocs/struts-1.3.10/org/apache/struts/action/ActionRedirect.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM