Foros de discusión

Fire action request before render?

Sebastian Monte, modificado hace 12 años.

Fire action request before render?

New Member Mensajes: 2 Fecha de incorporación: 31/01/12 Mensajes recientes
I have a simple need, to execute action request before the default render method takes place. This seems to be rather impossible to achieve...

Use case:

I have a portlet on a layout. That portlet needs to send a redirect to a completely new page, if some conditions are met. However, how can I congfigure the portlet so that when it is rendered in the layout, the action method is processed as default. I'm using Spring portlets.

The following does not work:


        @ActionMapping
	public void init(ActionRequest request, ActionResponse resposen) {
		...
	}

	@RenderMapping
	public ModelAndView home(RenderRequest request, RenderResponse response) {
              ...
        }


I have tried to put the following in friendly URLs


<routes>
	<route>
		<pattern></pattern>
		<ignored-parameter name="p_p_lifecycle" />
		<overridden-parameter name="p_p_lifecycle">1</overridden-parameter>
	</route>
</routes>
thumbnail
David H Nebinger, modificado hace 12 años.

RE: Fire action request before render?

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
Render is called upon first display of the portlet.

Action is only called when the user invokes some action in the portlet. After the action is complete, the render phase is invoked again.

This is the JSR 168 standard for the portlet lifecycle. Liferay implements and supports the standard.

You are trying to violate the standard and do something that is unsupported.

Perhaps some alternative would be more appropriate?
Sebastian Monte, modificado hace 12 años.

RE: Fire action request before render?

New Member Mensajes: 2 Fecha de incorporación: 31/01/12 Mensajes recientes
Thank you for your reply.

Yes, alternatives are always welcome. Basically I just have a need to redirect to another page if some conditions are met. Is there some request / layout hook that I could use before the portlet is in its render phase? Javascript redirection is not really an option, since it's not SEO friendly and users do not have JS always on.
Arvind Gupta, modificado hace 10 años.

RE: Fire action request before render?

Junior Member Mensajes: 29 Fecha de incorporación: 18/12/12 Mensajes recientes
Did you get the solution if yes , please share.