Forums de discussion

Interporlet Communication - IPC, how to communication between 2 portlets

Ram Mugalipoo, modifié il y a 8 années.

Interporlet Communication - IPC, how to communication between 2 portlets

New Member Publications: 5 Date d'inscription: 02/07/15 Publications récentes
Dear Community,

I'm a newbie for Liferay Development. I want to development 2 portlets 1. Left Navigation Portlet , 2.Content Portlet.

Left Navigation Portlet will contain certain links and based the links clicked respective jsp pages should be in the content portlet, Very simple and standard usage which any website has.

Can somebody guide me or point to sample/blog to implement the same. I have done some base work but the cus.jsp doesn't show in the ContentPortlet.
Please find inline comments where i have narrated my problem. Please help me....

1. I have created 2 portlet(Nav and Content) in the same portlet plugin project for both portlets
<supported-publishing-event>
<qname xmlns:x="http://qlikview.com/events">x:ipc.customer</qname>
</supported-publishing-event>

<supported-publishing-event>
<qname xmlns:x="http://qlikview.com/events">x:ipc.site</qname>
</supported-publishing-event>

2. Included the actionURLs in Nav-portlets view.jsp
<a href="<portlet:actionURL name="customer" />">Customer</a>
</br>
<a href="<portlet:actionURL name="site" />">Site</a>

3.Included the code for the action in Navportlet.java

@ProcessAction(name = "customer")
public void cricketBall(ActionRequest request, ActionResponse response){


String cusLink = "/html/nav/cus.jsp"; //This is the parameter im trying to pass to the content portlet
QName qName = new QName("http://qlikview.com/events", "ipc.pi");
System.out.println("You called customer");//No issues. i can see the output in console
response.setEvent(qName, cusLink);
}

The same code with the modification is done for site in Navportlet.java. No issues with the Left Nav portlet

4.
@ProcessEvent(qname = "{http://qlikview.com/events}ipc.customer")
public void customer(EventRequest request, EventResponse response) throws IOException, PortletException {
Event event = request.getEvent();
String cusLink = (String) event.getValue();
System.out.println(cusLink);//No issues. "/html/nav/cus.jsp" is printed in the Console

/* I'm stuck here. It doesn't show up the cus.jsp in the ContentPortlet and i don't know how to take it further.' */
PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(cusLink);
prd.include(request, response);
//response.setRenderParameter("", pitch);
thumbnail
Devang Patel, modifié il y a 8 années.

RE: Interporlet Communication - IPC, how to communication between 2 portlet

Regular Member Publications: 247 Date d'inscription: 19/01/15 Publications récentes
Hi Ram Mugalipoo

These are the two portlets which is configured using IPC.
Try this and understand the code how it works!

Thank You,
Devang Patel