Foren
Sending a parameter to a portlet placed on another page [SOLVED]
Lirone75 M., geändert vor 12 Jahren.
Sending a parameter to a portlet placed on another page [SOLVED]
Regular Member Beiträge: 118 Beitrittsdatum: 19.03.07 Neueste Beiträge
Hi,
I try to send a parameter to a portlet placed in another page, so I used the PortletURLFactoryUtil that seems to provide the good PortletURL for my need, because it takes all that I have to worry : LayoutId, portletName, request
For <portlet-name>, I try many things (let say my portlet name is "my-portlet", it is not instanceable, the war name deployed in liferay is my-portlet-portlet.war) :
- my-portlet
- my-portlet_WAR_my-portlet-portlet
But it doesn't work.
I try to send a parameter to a portlet placed in another page, so I used the PortletURLFactoryUtil that seems to provide the good PortletURL for my need, because it takes all that I have to worry : LayoutId, portletName, request
public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException {
PortletURL portletURL = PortletURLFactoryUtil.create(PortalUtil.getHttpServletRequest(request), <portlet-name>, 29422, PortletRequest.RENDER_PHASE);
String words = ParamUtil.getString(request, "words");
response.sendRedirect(portletURL.toString());
}
</portlet-name>
For <portlet-name>, I try many things (let say my portlet name is "my-portlet", it is not instanceable, the war name deployed in liferay is my-portlet-portlet.war) :
- my-portlet
- my-portlet_WAR_my-portlet-portlet
But it doesn't work.
Lirone75 M., geändert vor 12 Jahren.
RE: Sending a parameter to a portlet placed on another page
Regular Member Beiträge: 118 Beitrittsdatum: 19.03.07 Neueste Beiträge
It works for portletname "myportlet_WAR_myportletportlet" NOT "my-portlet_WAR_my-portlet-portlet".
That's weird because in theme when we want to embbed a portlet the id has the format : my-portlet_WAR_my-portlet-portlet.
Do you know where is specified the format of portletName/portletId parameter ?
That's weird because in theme when we want to embbed a portlet the id has the format : my-portlet_WAR_my-portlet-portlet.
Do you know where is specified the format of portletName/portletId parameter ?
Thiago Leão Moreira, geändert vor 12 Jahren.
RE: Sending a parameter to a portlet placed on another page
Liferay Legend Beiträge: 1449 Beitrittsdatum: 10.10.07 Neueste Beiträge
The name must be always myportlet_WAR_myportletportlet without dashes even in themes.
Lirone75 M., geändert vor 12 Jahren.
RE: Sending a parameter to a portlet placed on another page
Regular Member Beiträge: 118 Beitrittsdatum: 19.03.07 Neueste Beiträge
yes that's right.
Tanweer Ahmed ., geändert vor 1 Jahr.
RE: Sending a parameter to a portlet placed on another page [SOLVED]
Expert Beiträge: 322 Beitrittsdatum: 11.03.10 Neueste Beiträge
Hi Lirone ,
Use the following code to get the portletName and pl_id dynamically.
Hope this helps.
Regards,
Tanweer
mPowerian-BoschLer
Use the following code to get the portletName and pl_id dynamically.
String portletName = (String)actionRequest.getAttribute(WebKeys.PORTLET_ID);
PortletURL portletURL = PortletURLFactoryUtil.create(PortalUtil.getHttpServletRequest(actionRequest), portletName, themeDisplay.getLayout().getPlid(), PortletRequest.RENDER_PHASE);
Hope this helps.
Regards,
Tanweer
mPowerian-BoschLer
Lirone75 M., geändert vor 12 Jahren.
RE: Sending a parameter to a portlet placed on another page [SOLVED]
Regular Member Beiträge: 118 Beitrittsdatum: 19.03.07 Neueste BeiträgeTanweer Ahmed Ansari:
Hi Lirone ,
Use the following code to get the portletName and pl_id dynamically.String portletName = (String)actionRequest.getAttribute(WebKeys.PORTLET_ID); PortletURL portletURL = PortletURLFactoryUtil.create(PortalUtil.getHttpServletRequest(actionRequest), portletName, themeDisplay.getLayout().getPlid(), PortletRequest.RENDER_PHASE);
Hope this helps.
Regards,
Tanweer
mPowerian-BoschLer
No my concern is not retrieving the portlet id in the scope of portlet, but outside of the portlet.
The format of id is give here : http://www.liferay.com/community/wiki/-/wiki/Main/Theme+Id+or+Portlet+Id+references+in+portal-ext.properties without dashed and period.
The topic is [SOLVED], so it's closed : NO OTHER ANSWER is expected.