Java 使用参数从ActionRequest发送重定向
我试图重定向到ActionRequest中的另一个portlet,我需要发送一个参数。当我将它添加到响应中时,它会忽略它Java 使用参数从ActionRequest发送重定向,java,spring-mvc,Java,Spring Mvc,我试图重定向到ActionRequest中的另一个portlet,我需要发送一个参数。当我将它添加到响应中时,它会忽略它 @ActionMapping(params = { "action=create" }) public void create(ActionRequest request, ActionResponse response, @Valid @ModelAttribute("formObject") FormObject formObject, BindingResult re
@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。请问我怎样才能做到这一点?您可以使用会话
actionRequest.getPortletSession().setAttribute("action", "myaction");
我已经设法使它起作用了。我不得不使用
response.setRenderParameter("action", "myAction");
现在,它终于添加了参数。将其添加到重定向:response.sendRedirect(“/nextportlet?action=myAction”)@我想这是最后一个选择,但我可能不得不这么做。。我没有主意了。不幸的是,这对我不起作用:(不知道为什么,听起来很合乎逻辑。