Vue combinée Vue Plate Arborescence
Sujets [ Précédent | Suivant ]
toggle
Debopam Mitra
Portlet to Portlet submit v. IPC
24 août 2014 12:52
Réponse

Debopam Mitra

Rang: Junior Member

Publications: 38

Date d'inscription: 27 septembre 2012

Publications Récentes

I was thinking what would be the best choice, for sending a data from one portlet to another portlet.

All I want to do is to take a input from one portlet and send it to the action phase of another portlet.

I know to achieve a flow where a form in one portlet directly submits to the process action of another flow is through the following:

 1<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
 2<%@ taglib prefix="aui" uri="http://alloy.liferay.com/tld/aui"%>
 3<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
 4<portlet:defineObjects />
 5
 6
 7<liferay-portlet:actionURL var="actionURL" portletName="portlet_2_WAR_InterportletPostportlet" windowState="maximized"/>
 8<aui:form action="<%=actionURL%>" method="post">
 9    <aui:input name="message" label="Enter Your Message" />
10    <aui:button type="submit" value="Submit" />
11</aui:form>


In this scenario my portlet_1 & portlet_2 are in the same page. Although the data has been received in the processAction of portlet_2, a problem surfaces. The problem is the portlet_1 that is in the same page is gone.

Q 1. Is the redirection that is happening removing the portet_1?
Q 2. How can I solve this?

Even if I solve this, my main question for this thread:

Is this the right process methodology to send the data? Or I need to implementing server side eventing?
Debopam Mitra
RE: Portlet to Portlet submit v. IPC
24 août 2014 13:14
Réponse

Debopam Mitra

Rang: Junior Member

Publications: 38

Date d'inscription: 27 septembre 2012

Publications Récentes

Answers to Q1 & Q2. I have set the windowState to maximized and looking for the other portlet to show up. Not possible. So I change windowState="maximized" to windowState = "normal". emoticon


Any way the main question still remains, in these scenario should I have used IPC or Portlet to Portlet submit is good to go?
Olaf Kock
RE: Portlet to Portlet submit v. IPC
24 août 2014 23:25
Réponse

Olaf Kock

LIFERAY STAFF

Rang: Liferay Legend

Publications: 3431

Date d'inscription: 23 septembre 2008

Publications Récentes

Q2: You can solve this by describing the problem that you want to solve with this. This will make it possible to propose an alternative solution that doesn't mean posting from one portlet to the other through the action phase.

Think of portlets as distinct architectural boundaries. There's nothing to ensure that both portlets will be on the same page, and they're completely separated from each other by design. If you want them to interact, you'd have to break down this border knowingly. Whoever is maintaining your portlets in the future might not expect such behaviour and will most likely be somewhat puzzled by the behaviour you implement.

Rather than "crossposting" to each other's action handler, I'd suggest to 1) have a common business layer, where both portlets share their state, so that changes made in one portlet have an effect on the other. Or 2) use Inter-Portlet-Communication (e.g. Events or Public Render Parameters) to distribute changed state between the two.

I don't like most alternatives of DOM manipulations within "the other portlet's part of the DOM". This typically creates hard-to-maintain systems. You might need some client-side portlet interaction if you have an Ajax-heavy solution that doesn't involve a complete roundtrip to the server. But even in this case I wouldn't recommend to manipulate the DOM, rather introduce a client side event-notification system. Not understood? Well, I consider this a heavy solution anyways, and would recommend it only in a few select cases. Stick with the first suggestions
Debopam Mitra
RE: Portlet to Portlet submit v. IPC
25 août 2014 10:45
Réponse

Debopam Mitra

Rang: Junior Member

Publications: 38

Date d'inscription: 27 septembre 2012

Publications Récentes

Thanks, for this clear concept.

But again a question arises,

by
have a common business layer, where both portlets share their state, so that changes made in one portlet have an effect on the other.
,

you mean what ?
Olaf Kock
RE: Portlet to Portlet submit v. IPC
26 août 2014 01:05
Réponse

Olaf Kock

LIFERAY STAFF

Rang: Liferay Legend

Publications: 3431

Date d'inscription: 23 septembre 2008

Publications Récentes

Portlets are a UI concept - you'll hopefully have a business layer that the portlets provide the UI for, and it's easy to have multiple portlets access the same business logic. Just share some of your state (e.g. the current customerId) so that multiple portlets can show multiple aspects of a customer. If one portlet changes data, the others can show this updated data.