Fórum

Redirect from a portlet view to another portlet with RenderURL

thumbnail
Corentin R, modificado 13 Anos atrás.

Redirect from a portlet view to another portlet with RenderURL

Junior Member Postagens: 92 Data de Entrada: 18/06/10 Postagens Recentes
Hi !

I'm new to portlet development but I think I'm missing some important point here emoticon

I would like to redirect from a portletA view (jsp) to another portlet (let's say it name in portlet.xml is portletNameB ).
To do so I tryed to redirect from the view of PortletA to the portletB with a renderURL like this :
<liferay-portlet:renderurl portletname="portletNameB_WARname" varimpl="redirectURL">
<liferay-portlet:param name="jspPage" value="/html/pathToJsp.jsp" />
</liferay-portlet:renderurl>
<aui:button value="redirectButton" onClick="<%=redirectURL.toString()%>" name="redirectButton" />


If I specify a windowState attribute to Exclusive or Maximize it correctly called the render method from my portletB and after that it displays the view.
Otherwise it will always call the render method from my portletA and displays the default view (my jspPage param seems to be lost)

Is it possible to use Normal Windows state to simply display in my portletA area the view of a portletB ?
Will the actionURL on my portletB view still working and calling actions of the portletB after redirection?

Thanks a lot for your help.
thumbnail
Corentin R, modificado 13 Anos atrás.

RE: Redirect from a portlet view to another portlet with RenderURL

Junior Member Postagens: 92 Data de Entrada: 18/06/10 Postagens Recentes
By the way I'm using liferay 6.0.6 and MVCPortlet if that could help...

And if I used
<liferay-portlet:actionurl name="methodB" portletname="portletNameB_WARname" varimpl="redirectURL"></liferay-portlet:actionurl>
instead of
<liferay-portlet:renderurl portletname="portletNameB_WARname" varimpl="redirectURL"></liferay-portlet:renderurl>
the methodB is called during actionPhase but during RenderPhase it's always the render method from PortletA wich will be called redirecting me to the the default view from portletA emoticon

Please help ...
thumbnail
Mohammed Azam, modificado 12 Anos atrás.

RE: Redirect from a portlet view to another portlet with RenderURL

Regular Member Postagens: 159 Data de Entrada: 06/11/09 Postagens Recentes
Hi Corentin

You can try this Liferayurl to create the renderURL of the second portlet.

String portletName = "mysearchportlet";

	LiferayPortletURL secondURL = PortletURLFactoryUtil.create(request,
			portletName, plid, PortletRequest.RENDER_PHASE);


Hope this helps.
thumbnail
Luis Rodríguez Fernández, modificado 12 Anos atrás.

RE: Redirect from a portlet view to another portlet with RenderURL

Junior Member Postagens: 86 Data de Entrada: 26/06/09 Postagens Recentes
Hi Coretin,

I think that you could try the code that Mohammed has kindly suggested to you.

If it helps for me the <liferay-portlet:actionURL> tag its working. The only difference is that I am using struts2 for developing my portlets. You can take a look to this forum post

Hope it helps,

Luis
thumbnail
Corentin R, modificado 12 Anos atrás.

RE: Redirect from a portlet view to another portlet with RenderURL

Junior Member Postagens: 92 Data de Entrada: 18/06/10 Postagens Recentes
Mohammed, Luis thanks for your replies,
I've tryed both of your solutions but unfortunatly the link always get me back to the default view from my portlet without event calling the render method from my portletB...
But if I change the windowState to MAXIMIZED there it works emoticon
By the way Mohammed is it possible to call the PortletURLFactoryUtil.create with a portletName without any WAR reference in it and only the portlet name from portlet.xml?
In this case I supposed the portlet must be in the same WAR as the portlet from which it's called ?
thumbnail
Mohammed Azam, modificado 12 Anos atrás.

RE: Redirect from a portlet view to another portlet with RenderURL

Regular Member Postagens: 159 Data de Entrada: 06/11/09 Postagens Recentes
Hi,

In that case you can try using this code


PortletURL myaccountURL = new PortletURLImpl(request, PortletKeys.MY_ACCOUNT, plid.longValue(), PortletRequest.RENDER_PHASE);
myaccountURL.setWindowState(WindowState.MAXIMIZED);
myaccountURL.setParameter("struts_action", "/my_account/view");



I had used this to call myaccount in my portlet
thumbnail
Corentin R, modificado 12 Anos atrás.

RE: Redirect from a portlet view to another portlet with RenderURL

Junior Member Postagens: 92 Data de Entrada: 18/06/10 Postagens Recentes
Mohammed Azam:
Hi,

In that case you can try using this code


PortletURL myaccountURL = new PortletURLImpl(request, PortletKeys.MY_ACCOUNT, plid.longValue(), PortletRequest.RENDER_PHASE);
myaccountURL.setWindowState(WindowState.MAXIMIZED);
myaccountURL.setParameter("struts_action", "/my_account/view");



I had used this to call myaccount in my portlet


But in this case the portlet will be opened in maximized state...
And that's allready working in this case.
My problem occures when I try to call the view of a portlet B with a Normal WindowState from the view of a portlet A.
At this time I've not found another solution than extending portlet A from portlet B.
romain vergnais, modificado 12 Anos atrás.

RE: Redirect from a portlet view to another portlet with RenderURL

New Member Postagens: 3 Data de Entrada: 02/05/11 Postagens Recentes
Hi,

I encountered the same windowstate problem in normal mode, it only renders in maximized state.

Did anyone found a solution to this issue ?
Thomas Kevin, modificado 12 Anos atrás.

RE: Redirect from a portlet view to another portlet with RenderURL

New Member Postagens: 9 Data de Entrada: 05/05/11 Postagens Recentes
Hi please try,

Using JSR286 WebSphere Portal 6.1.

In JSR286 share parameters from a specific portlet to a specific set of other portlets using the setRenderParameter API. In JSR 168, It was only limited for the same portlet (not with others).

Try to use new WebSphere Portal 6.1 ....


Regards
Kevin Thomas
Attune Infocom Inc
Email : contact@attuneinfocom.com
Liferay Portlet
thumbnail
Himanshu Bhandari, modificado 8 Anos atrás.

RE: Redirect from a portlet view to another portlet with RenderURL

Regular Member Postagens: 148 Data de Entrada: 09/05/14 Postagens Recentes
Hi
(update for visitors of 2015)
as per Liferay 6.2 if I use
 portletName="portletNameB_WARname" 
, I am getting this error
Attribute portletName invalid for tag renderURL according to TLD

Thanks