掲示板

portlet events across pages

14年前 に Torsten Lehmann によって更新されました。

portlet events across pages

New Member 投稿: 5 参加年月日: 09/10/20 最新の投稿
Hi,

I'm testing Liferay 5.2.3 and therefore wrote a webapp containing 2 simple portlets.
Portlet A shows 2 text inputfields and a submit button, which publishes an event containing the 2 input values.
Portlet B simply shows this 2 values.
This is working if the 2 portlets are on the same page, but when portlet B is on an other page it never shows the given input values.

Can anybody tell me how to process the event of portlet A in portlet B even when they are not on the same page?

Thanks

Torsten
14年前 に Rice Owl によって更新されました。

RE: portlet events across pages

Regular Member 投稿: 177 参加年月日: 09/04/24 最新の投稿
Depending on what kind of events you want to capture, this may be helpful. Its more of an indirect way of responding to an event on a different page. Basically, I make use of Session variables and sendRedirect method of ActionResponse method. The "receiving" or target page will then do a lookup on the session and respond to the event. The session variable can be anything from a primary key (if you want to load an entity/data) or define an event, depending on your needs.

For instance, let's say I have a portlet, BusinessListPortlet, which is on one page. On another page I have a BusinessProfilePortlet which is found on another page. The BusinessListPortlet lists a bunch of businesses, which are simply data stored on some database (and have a primary key). The JSP page on BusinessListPortlet has a form and a bunch of links for each business. When a link is clicked (ie, clicking on a business), a form is submitted and BusinessListPortlet then grabs the business ID (primary key), puts in on the session with APPLICATION_SCOPE and uses the sendRedirect method of ActionResponse object to send to the new page containing the BusinessProfilePortlet.

On the BusinessProfilePortlet, in the doDispatch() method, you can lookup the session variable, in this case the business id, then you can do necessary lookups and handle loading the data.

That was an example of using a redirect to load particular data on a different page, in response to a click on a page. You can do other things as well, for instance, you could have other types of data put on the session, such as something like an action that the receiving portlet can then interpret.

If these two portlets on in different WAR files, you need to look into sharing sesison variable across multiple WAR files.

In your specific case, you can do pretty much the same thing, except put the 2 values you are interested in displaying on the session and call the sendRedirect method. Then the receiving portlet (on a different page) can lookup these two values in the session and display on its JSP page.
14年前 に Torsten Lehmann によって更新されました。

RE: portlet events across pages

New Member 投稿: 5 参加年月日: 09/10/20 最新の投稿
Thanks, but I don't want to use this indirect way through session variables.

My 2 Portlets are in the same war, but on 2 different pages (tabs in navigation of Liferays classic theme) and if portlet A in tab 1 publishes its event portlet B on tab 2 should be able to process it.
But in my application portlet B only processes the event if it is located on the same tab, although I defined portlet.event.distribution=ALL_PORTLETS in portal-ext.properties. Is there any way to get this working or is everybody else using session variables to handle this case?

Thanks

Torsten
14年前 に Todd Volle によって更新されました。

RE: portlet events across pages

New Member 投稿: 2 参加年月日: 09/11/18 最新の投稿
I'm having the same problem. Events published on one page only get handled by portlets on the same page.
Is there any way around this?
Also, I have the same portlet appearing on several pages. Each portlet gets a separate session instead of sharing one.
13年前 に David Rosell によって更新されました。

RE: portlet events across pages

New Member 投稿: 2 参加年月日: 10/02/11 最新の投稿
Is portlet events accross pages broken in 5.2.3?

I have the same problem and have seen a couple of suggestions:

portlet.event.distribution=ALL_PORTLETS
portlet.event.max.generation=3
portlet.public.render.parameter.distribution=ALL_PORTLETS

or

portlet.event.distribution=layout-set (from Liferay In Action Ch4)

but nothing seems to work.

Any suggestions.
13年前 に Martin Biastoch によって更新されました。

RE: portlet events across pages

New Member 投稿: 3 参加年月日: 08/02/11 最新の投稿
I have the same problem! Does it work in older versions of liferay? Has someone experiences?
13年前 に Klaus Meyer によって更新されました。

RE: portlet events across pages

New Member 投稿: 11 参加年月日: 10/01/19 最新の投稿
Dear Sirs,

obviously ´portlet events across pages´ was broken in 5.2.3.

(portlet.event.distribution=ALL_PORTLETS
in portal-ext.properties did not work as expected).

Now, my question is: Is it working in 6.0.5?

I would move over to the new version just to get this working.


Thank you for your answer!
thumbnail
13年前 に Tomas Polesovsky によって更新されました。

RE: portlet events across pages

Liferay Master 投稿: 676 参加年月日: 09/02/13 最新の投稿
Dear Klaus

AFAIK in version 6 there are big changes - there is no more support for Sun Portlet container and Liferay has just its own implementation.

I guess it could work emoticon But you still need to try it ;)

-- tom
13年前 に Klaus Meyer によって更新されました。

RE: portlet events across pages

New Member 投稿: 11 参加年月日: 10/01/19 最新の投稿
Is there someone, who has already tried it?

What could be a workaround?
13年前 に Klaus Meyer によって更新されました。

RE: portlet events across pages

New Member 投稿: 11 参加年月日: 10/01/19 最新の投稿
Hello!

Can I start a new thread here in forum?
How can I do that?

Thank you!
9年前 に Nasir Hussain によって更新されました。

RE: portlet events across pages

New Member 投稿: 18 参加年月日: 10/04/26 最新の投稿
portlet.event.distribution=ALL_PORTLETS


No longer supported, it should be portlet.event.distribution=layout_set according to liferay implementation