Struts 1.3动作转发参数

TGM*_*TGM 16 java forwarding struts-1

我正在开发一个使用Struts 1.3的小项目,我遇到了以下问题.

在一些业务逻辑发生之后,Action我想将控件转发给映射到的另一个Action struts-config.xml.

通常这是我解决这个问题的方式:

struts-config.xml中

<action path="/boardCreate" type="com.example.BoardCreateAction" name="BoardCreateForm" input="/board.jsp">
    <forward name="success" path="/board.do" redirect="true" />
</action>
Run Code Online (Sandbox Code Playgroud)

Java动作类

return mapping.findForward("success");
Run Code Online (Sandbox Code Playgroud)

这将重定向到board.do也映射到那里的动作.

我的问题是我想将控件重定向到:

<forward name="success" path="/board.do?id=1" redirect="true" />
Run Code Online (Sandbox Code Playgroud)

注意id = 1参数.除了重建我自己的行动之外,这是否还有其他任何方式?我找不到任何辩论此事的文件.谢谢!

JB *_*zet 39

ActionRedirect redirect = new ActionRedirect(mapping.findForward("success"));
redirect.addParameter("id", theId);
return redirect;
Run Code Online (Sandbox Code Playgroud)

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