Java Struts 1: forward from action to action. Passing data through ActionForms

前端 未结 3 1185
没有蜡笔的小新
没有蜡笔的小新 2021-02-13 09:55

We\'ve been trying to redirect from one action to another, hoping that data would be passed between corresponding ActionForm beans. The first action receives a requ

3条回答
  •  广开言路
    2021-02-13 10:17

    Tom, using you solution and combining with ActionRedirect, suggested by Vincent Ramdhanie, I got what you wanted too.

    The code is simple as that and it allow you to have separated Forms for each Action.

    ActionRedirect redirect = new ActionRedirect(mapping.findForward("send"));
    redirect.addParameter("commonInt", formA.getCommonInt());
    return redirect;
    
    formB.setCommonInt(request.getParameter("commonInt"));
    

    This endend up saving my day and helping me not to have the effort to change that directly in the JSP, what would be awful.

提交回复
热议问题