活动在Liferay Portlet [英] Eventing in Liferay Portlets

查看:178
本文介绍了活动在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> JSR-286(最新的Java Portlet规范)定义了服务器端和客户端端口通信(IPC)。对于Liferay实施,他们已经很好地描述了 here here

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.


在任何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?


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

  • 服务器端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)

  • 我想为每个事件分配唯一的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?




    • 这是个好主意。一个常见的实现是使用网址片段标识符(hash)来存储URL中的状态。一个可以使用的JQuery实现就是 JQuery BBQ

      • 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

      • 此外,如果页面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. How can I eliminate this?




        • 我假设你在说相同的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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆