2014-09-22 61 views
0

我有一个eclipse中的portlet项目列表,比如说20(新的也许将来或者未来)。Liferay - portlet之间的客户端通信

我想要做的是:

  • 创建新的portlet,将听取所有按钮的交互 上所有20个左右的portlet
  • 显示的结果(成功或失败)使用我刚刚创建的这个portlet。

我试图寻找IPC,但他们都有一个例子,其中一个portlet发射一个事件,不止一个正在侦听,但我想做的事情反之亦然。

我们该如何做到这一点?有什么建议么?

回答

4

您正在寻找客户端IPC。所以,你需要做的是,你可以有多个事件与

Liferay.fire(eventName, data) 
Liferay.on(eventName, function, [scope]) 

火事件将发送者的portlet被解雇绑定,您可以从多个portlet的多个触发事件。 要监听那些需要liferay.on的事件,无论是在单个portlet还是在多个portlet中。 您可以使用下面的格式和样本代码

Liferay.on('eventName',function(event) { 
// write code to get the veluese that sent by sender portlet 
}); 

Example code as follows in receiver portlet view.jsp 

Liferay.on('getUserData',function(event) { 
alert('User Name:'+ event.name) 
}); 

欲了解更多信息,你可以通过以下链接搭起多个事件在接收器的portlet JSP(S)。 http://www.liferaysavvy.com/2014/01/liferay-client-side-inter-portlet.html https://www.liferay.com/web/meera.success/blog/-/blogs/liferay-client-side-inter-portlet-communication-using-ajax http://www.liferay.com/community/wiki/-/wiki/Main/Inter-portlet+communication