The portlet execution life cycle is separated in two: The action/event
phase, in which state transitions (typically a form submit) occurs,
and then the render phase, where the actual output is rendered. The
request object that is available in these two phases are not the same.
In the action phase, there is no RenderRequest, only an ActionRequest,
and opposite in the render phase. So what's happening is that the
action is probably invoked in the action phase in the second case. I
suggest that you use a redirectAction result from the action that is
processing the submit to avoid this from happening.

Nils-H

2009/8/6 Leonidas Papadakis <l...@bluecore.gr>:
> Greetings to all ,
>
> i have setup latest struts 2.1.6 and created a simple portlet for liferay
> 5.2.3
>
> Everything went smoothly until i tried to run the below code :
>
> RenderRequest req = PortletActionContext.getRenderRequest();
>       ThemeDisplay themeDisplay = (ThemeDisplay)
> req.getAttribute(WebKeys.THEME_DISPLAY);
>       PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
>
> in a new action that i called from the index view action. This code runs
> smoothly on the index view action but in my second action i get the below
> exception
>
> java.lang.IllegalStateException: RenderRequest cannot be obtained in event
> phase
> at
> org.apache.struts2.portlet.context.PortletActionContext.getRenderRequest(PortletActionContext.java:66)
>
> in the first line ( RenderRequest req =
> PortletActionContext.getRenderRequest(); )
>
> I would really appreciate any replies since i am on a tight schedule.
>
> Regards,
>
> Leon
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to