ASR
ASR

Reputation: 3549

pass a parameter from jsp page hook to runtime portlet in same hook

I have a jsp page hook, in that I have included a runtime portlet, I need to pass a portlet instance from jsp page hook to to runtime portlet which is in the same jsp page hook.How can I pass the portlet instance id to runtime portlet ? thanks in advance.

I have tried below things: I am getting portlet instance empty

In jsp page hook:

<liferay-portlet:runtime portletName="ContentCustomization_WAR_ContentCustomizationportlet" queryString="instance='<%=themeDisplay.getPortletDisplay().getInstanceId()%>'" />

in render() method of ContentCustomizationportlet:

String instance = httpRequest.getParameter("instance");

in jsp page of ContentCustomizationportlet

String instance=renderRequest.getParameter("instance");

Upvotes: 1

Views: 1333

Answers (1)

ASR
ASR

Reputation: 3549

In jsp page hook:

<c:set var="webcontentInstanceId" scope="request" value="<%=themeDisplay.getPortletDisplay().getInstanceId()%>"/>

<liferay-portlet:runtime portletName="ContentCustomization_WAR_ContentCustomizationportlet" queryString="&instanceId=${webcontentInstanceId}"  />

In your jsp retrieve like:

String instance=renderRequest.getParameter("instanceId");

if you want to get in action class

HttpServletRequest httpRequest2 = PortalUtil.getHttpServletRequest(renderRequest);

String instance=httpRequest2.getParameter("instanceId");

Upvotes: 1

Related Questions