使用参数从ActionRequest发送重定向

时间:2013-10-18 09:48:00

标签: java spring-mvc

我正在尝试重定向到ActionRequest中的另一个portlet,我需要发送一个参数。当我将它添加到响应中时,它会忽略它。

@ActionMapping(params = { "action=create" })
public void create(ActionRequest request, ActionResponse response, 
@Valid @ModelAttribute("formObject") FormObject formObject,
BindingResult result) throws IOException, RepositoryException, 
PortalException, SystemException {

    // do some stuff and then

    response.setParameter("action", "myAction");
    response.sendRedirect("/next-portlet");

}
不幸的是,

myAction没有传递给下一个portlet。我怎么能实现这个目标呢?

2 个答案:

答案 0 :(得分:0)

您可以使用会话

actionRequest.getPortletSession().setAttribute("action", "myaction");

答案 1 :(得分:0)

我设法让它发挥作用。我不得不使用

response.setRenderParameter("action", "myAction");

现在它最终添加了参数。