0
votes

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.

2
Next time onwards please try to format the code in your questions properly, so that it helps fellow members to answer it promptly. ThanksPrakash K
I'm a bit lost here on what you're trying to achieve: Is it that you have two portlets on a page and one portlet should generate HTML code that submits http requests to the other? (If so, how do you know that both are indeed on the same page?) Or are you asking about how to implement IPC to be able to distribute changes in one portlet to another? (I consider this as a cleaner solution)Olaf Kock

2 Answers

0
votes

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.

0
votes

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.