sweety
sweety

Reputation: 73

Portlet to Portlet communication in liferay

I have two portlets: Display-portlet and Comment-portlet.

Display-portlet
This shows a grid (html <table>) for which the details come from the database. Each table row shows vendor details and has a href link, that should get connected to my Comment portlet and pass parameters like vendor-name, transcation-id to Comment-portlet.

On each row a link is there and on select of a particular vendor his detail should pass to the second portlet.

I have tried portlet-to-portlet event mechanism which passes information through process action, so I am trying to implement the same logic over here, but my parameters are not passed to the action class.


My Display portlet's view.jsp has the following table:

<table>
    <tr>
        <th>Trans.ID</th>
        <th>Vendor Name</th>
        <th>Action</th>
        <th>Discuss</th>
    </tr>
    <tr>
        <td align="center" id="trans_id">
            <%=chatEntry.getTransactionId()%>
        </td>
        <td align="left" id="vname_id">
            <%=chatEntry.getVendorName()%>
        </td>
        <td align="center" id="status_id">
            <%=chatEntry.getStatus()%>
        </td>
        <td align="center">
            <a href="javascript:submitForm()">click</a>
        </td>
    </tr>
</table>

Please help as to how should I pass my each row values to other portlet.

When I try to use hidden values, by default only first value gets selected. Please suggest a solution if there is some other way to handle this.

This question may not be completely Liferay-IPC, but if a better solution provided will be appreciated.

Upvotes: 0

Views: 658

Answers (2)

Temire Emmanuel
Temire Emmanuel

Reputation: 82

From your JSP script i am guessing that your portlet is a Liferay MVCPortlet.

You can do this as you would any Java Web project using JSP using request.getParamater() method

This may require your to pass the parameters in a url to the page holding the Comment Portlet like /web/...../pagename?param=... as a GET method or hidden as a form POST method.

The parameters can now be gotten in the view.jsp of the Comment portlet You can now get the parameters for the action class by using PortletRequest or ActionRequest.

Upvotes: 0

Parkash Kumar
Parkash Kumar

Reputation: 4730

Detailed description about Portlet to Portlet communication can be found here:

https://www.liferay.com/community/wiki/-/wiki/Main/Portlet+to+Portlet+Communication?_36_pageResourcePrimKey=6629472

Best possible ways are:

1 - Sharing Session parameter and 2 - Client-side IPC.

Upvotes: 0

Related Questions