Try something like this:

<action name="editcontent" class="struts.actions.EditContentAction">
  <result type="redirectAction">
    <param name="actionName">index</param>
  </result>
</action>

This of course assumes that you have actually separated the processing
and view logic in these two actions.

You should also take a look at the portlet tutorial:
http://struts.apache.org/2.1.6/docs/struts-2-portlet-tutorial.html

Nils-H


2009/8/6 Leonidas Papadakis <l...@bluecore.gr>:
> Hi Nils-H and thanks for your reply. Much appreciated.
>
> At the moment this is in my struts.xml
>
> <package name="view" extends="struts-portlet-default" namespace="/view">
>          <action name="index" class="struts.actions.ContentAction">
>           <result>/WEB-INF/jsp/view/index.jsp</result>
>      </action>
>
>      <action name="editcontent" class="struts.actions.EditContentAction">
>           <result name="INPUT">/WEB-INF/jsp/view/edit.jsp</result>
>           <result name="SUCCESS">/WEB-INF/jsp/view/index.jsp</result>
>      </action>
>
>   </package>
>
> initially the portlet executes the index action and the code runs fine.
> Afterwards even if i call action index from a form or action editcontent i
> get the exception.
>
> How would i change the above configuration ?
>
> Thanks again
>
> Leon
>
> Nils-Helge Garli Hegvik wrote:
>>
>> 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
>>
>>
>>
>
>

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

Reply via email to