Foren

Portlet URL

thumbnail
mohammad azaruddin, geändert vor 10 Jahren.

Portlet URL

Expert Beiträge: 492 Beitrittsdatum: 17.09.12 Neueste Beiträge
HI all
i'm creating actionURL via PortletURL myURL = PortletURLFactoryUtil.create(.......) ; Api....

In my application i'm creating new instance dynamically....and In new instance above URL is not working for the first time.....


What might be the problem
thumbnail
Andew Jardine, geändert vor 10 Jahren.

RE: Portlet URL

Liferay Legend Beiträge: 2416 Beitrittsdatum: 22.12.10 Neueste Beiträge
What does the full set of your code look like? here is an example that I use --


        Layout layout = LayoutLocalServiceUtil.getFriendlyURL( themeDisplay.getScopeGroupId(), false, "/your/url/here");
        long plid = layout.getPlid();
        String portletID = "[portletname]_WAR_[deploymentcontext]";   //eg. mybookmarks_WAR_mybookmarksportlet

	PortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, portletID, plid, PortletRequest.ACTION_PHASE);
	portletURL.setWindowState(WindowState.MAXIMIZED);
	portletURL.setPortletMode(PortletMode.VIEW);
        portletURL.setParameter("var1", "value1");
        portletURL.setParameter("var2", "value2");
        portletURL.setParameter("var3", "value3");
...	


This is assuming that you don't want to use a portlet in the same layout. If you do then you can get the plid from the ThemeDisplay. The key here is the ACTION_PHASE which will tell the portlet to start there and not in the RENDER_PHASE.
thumbnail
mohammad azaruddin, geändert vor 10 Jahren.

RE: Portlet URL

Expert Beiträge: 492 Beitrittsdatum: 17.09.12 Neueste Beiträge
Thanks for your reply emoticonemoticonemoticon

I'm using same logic to create the URL....As i mentioned it is not working for the first time when i create new instance dynamically....second time it is Working


Yes it is not in same layout..and i'm using correct layout id
thumbnail
meera prince, geändert vor 10 Jahren.

RE: Portlet URL

Liferay Legend Beiträge: 1111 Beitrittsdatum: 08.02.11 Neueste Beiträge
HI

If it is multiple instance portlet then portlet id will contains _INSTANCE_A2s

like we have some pastern

example:
p_p_id=PortletX_WAR_OpenPortletAuiDialgportlet_INSTANCE_NVvxP2fkEI9Z


URL as Follows

http://localhost:8080/web/guest/home?p_p_id=PortletX_WAR_OpenPortletAuiDialgportlet_INSTANCE_NVvxP2fkEI9Z&p_p_lifecycle=0&p_p_state=maximized&p_p_state_rcv=1&p_p_col_id=column-1&p_p_col_count=5

So you need create instance Id dynamically i think...

You have look at following link

http://www.liferaysavvy.com/2013/11/working-with-liferay-urls.html


Regards,

Meera Prince
http://www.liferaysavvy.com
thumbnail
mohammad azaruddin, geändert vor 10 Jahren.

RE: Portlet URL

Expert Beiträge: 492 Beitrittsdatum: 17.09.12 Neueste Beiträge
HI prince

I'm creating new instance via liferay API dynamically....So when i create new instance, the URL is not working for the first time....I put SYSOUT in my action class to check wethr it is coming to ProcessAction method...But it is not coming..but it is redirecting to that layout


When i try for the second time it is working as expected...It is not going to processAction only at first try after creating new instance.....

My question is why it is not hitting processAction at very first time