本文介绍了活动在Liferay Portlet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在任何portlet应用程序中,如果在两个浏览器选项卡中打开包含portlet的同一页面,则第一页中的事件与第二个页面的区别如何?

In any portlet application, if the same page containing a portlet is opened in two browser tabs, how is the event in the first page distinguished from the second page?

我想为每个事件分配一个唯一的ID,将其存储并附加到URL中,以便链接可以共享。

I want to assign a unique Id for each event, store it and append it to the URL so that the link can be shared.

有人可以在此提供他们的想法?

Can someone provide their thoughts on this ?

此外,如果页面URL在其他计算机上打开,则页面上显示的数据与第一台计算机上显示的数据相同。这是全球设定的。

Also, if the page URL is opened on other computer the data shown on the page is the same as the data seen on the first computer. This is being set globally.

如何消除这个?

推荐答案

p> 定义了服务器端和客户端端口通信(IPC)。对于Liferay实施,他们已经很好地描述了和。

JSR-286 (latest Java Portlet Specification) defines Server Side and Client side Inter Portlet Communication (IPC). For Liferay implementation they are well described here and here.


  • 客户端IPC :不可能在两个不同的浏览器选项卡之间触发并收听Liferay JavaScript事件。所以他们将被自动区分。但是,您可以使用基于cookie的方法实现它(请参阅如果有兴趣)

  • 服务器端IPC :可以使用服务器端IPC在不同的客户端窗口之间共享数据(服务器端)(请参阅以上Liferay的链接示例)

  • Client Side IPC: it is NOT possible to fire and listen a Liferay javascript event between two different browser tabs. So they will be automatically distinguished. However you may use a cookie based approach to implement it (look here if interested)
  • Server Side IPC: it is possible to share data (server side) between different client windows using server side IPC (see the above Liferay's links for examples)



    • 这是个好主意。一个常见的实现是使用网址来存储URL中的状态。一个可以使用的JQuery实现就是

      • It's a good idea. A common implementation is to use a url Fragment Identifier (hash) to store state in the url. A ready to use JQuery implementation for that is JQuery BBQ



        • 我假设你在说相同的Liferay用户帐户(否则可以按Liferay中的角色,用户,组,用户组或组织对数据进行分级)。
          为了区分同一用户的不同计算机之间的数据,您可以存储和传回具有关于客户端计算机的状态信息的门户cookie。请参阅了解如何在Liferay中设置Cookie。 li>

          • I'm assuming you're talking of the same Liferay User account (otherwise it is possible to scope data by role, user, group, user group or organization in Liferay).To differentiate data among different computers for the same user, you can store and pass back to the portal cookie(s) with state information about the client computer. See here for how to set cookie in Liferay.
          • 这篇关于活动在Liferay Portlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 09:46