PortletURL在弹出窗口中打开另一个portlet

我有一个create_account.jsp的钩子。 在这个jsp中,我有一个javascript代码,我尝试在iframe弹出窗口中打开一个portlet或者从Liferay中弹出一些弹出窗口。

问题是:
如何提供portlet URL?
我该如何访问它?
在那个portlet中,我只想问一个YES或NO的问题,并根据用户的回答,重定向到其他页面。

  1. 要创建URL,您可以使用

        

    portletName="testPopup_WAR_testPopupportlet"这是您要打开的portlet的portletId。

    windowState="<%=LiferayWindowState.POP_UP.toString() %>"这对于在弹出窗口中显示portlet非常重要,否则它将打开带有导航的全部liferay页面。

  2. 您可以在JSP中编写的javascript使用上面的URL并打开弹出窗口和portlet:

     // this is one of creating function function showPopup(url) { var url = url; // this is one way of calling a pop-up in liferay // this way is specific to liferay Liferay.Util.openWindow( { dialog: { cache: false, width:800, modal: true }, id: 'testPopupIdUnique', uri: url } ); } // this is another way of creating a function in liferay Liferay.provide( window, 'showAUIPopUP', function(url) { var A = AUI(); // this is another way of calling a iframe pop-up // this way is not specific to liferay popupDialog = new A.Dialog( { id: 'testPopupIdUnique', centered: true, draggable: true, resizable: true, width: 800, stack: true } ).plug( A.Plugin.DialogIframe, { uri: url, iframeCssClass: 'ogilvy-dialog-iframe' } ); popupDialog.render(); }, ['aui-dialog','aui-dialog-iframe'] ); 
  3. 你可以简单地调用这些javascript函数:

      Popup using Liferay open-window   Pop-up using Alloy UI dialog  
  4. 将在弹出窗口的iframe内显示的portlet应该在liferay-portlet.xml具有true

      testPopup /icon.png false /css/main.css /js/main.js testPopup-portlet  true  
  5. 或者将portal-ext.properties的属性portlet.add.default.resource.check.whitelist作为:

     portlet.add.default.resource.check.whitelist=3,56_INSTANCE_0000,58,82,86,87,88,103,113,145,164,166,170,177,testPopup_WAR_testPopupportlet 

要查看此代码的实际操作,您可以从中下载2个portlet并参阅此liferay论坛中的说明。

希望这有助于更好地理解liferay。

您可以使用renderURL标记。 在JSP中只需放入一个表单,然后使用MVCPortlet类创建所需的treatemnet。

     

请注意,Liferay提供了一种使用AUI创建弹出窗口的方法: http : //www.liferay.com/community/liferay-projects/alloy-ui/demo? title = community-liferay-projects-alloy-ui-demos-dialog