java – PortletURL在弹出窗口中打开另一个portlet
我有一个create_account.jsp的钩子.
在这个jsp我有一个 javascript代码,我尝试在iframe弹出窗口或Liferay的一些弹出窗口中打开一个portlet. 问题是: 解决方法
>要创建URL,您可以使用< portlet:renderURL>或者< liferay-portlet:renderURL>
<liferay-portlet:renderURL var="testPopupURL" portletName="testPopup_WAR_testPopupportlet" windowState="<%=LiferayWindowState.POP_UP.toString() %>"> <liferay-portlet:param name="paramToPopup" value="customParameterToThePortlet" /> </liferay-portlet:renderURL> portletName =“testPopup_WAR_testPopupportlet”这是您要打开的portlet的portletId. windowState =“<%= LiferayWindowState.POP_UP.toString()%>”这对于在弹出窗口中显示portlet非常重要,否则它将打开带有导航和所有内容的完整liferay页面. // this is one of creating function function <portlet:namespace />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,'<portlet:namespace />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'] ); >您可以简单地将这些javascript函数称为: <a href="javascript: <portlet:namespace />showPopup('<%=testPopupURL%>')"> Popup using Liferay open-window </a> <a href="javascript: <portlet:namespace />showAUIPopUP('<%=testPopupURL%>')"> Pop-up using Alloy UI dialog </a> >将在弹出窗口的iframe内显示的portlet应该具有< add-default-resource> true< / add-default-resource>在liferay-portlet.xml中: <portlet> <portlet-name>testPopup</portlet-name> <icon>/icon.png</icon> <instanceable>false</instanceable> <header-portlet-css>/css/main.css</header-portlet-css> <footer-portlet-javascript>/js/main.js</footer-portlet-javascript> <css-class-wrapper>testPopup-portlet</css-class-wrapper> <!-- This property is necessary otherwise you would see a "Access denied for portlet" message when you try to open this portlet dynamically --> <add-default-resource>true</add-default-resource> </portlet> >或者应该将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并参考this liferay forum中的说明. 希望这有助于更好地理解liferay. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- java图形验证码生成工具类 web页面校验验证码
- java – Spring Data Cassandra:如何使用复合键查询表?
- haskell – 延迟数据类型的内存使用情况
- java – SpringData:是否可以在Query注释中包含子查询?
- java – 不使用递归遍历目录?
- java.lang.NoClassDefFoundError: org/springframework/cor
- java – com.github.tomakehurst.wiremock.client.Verifi
- java – 任何简单的方法来生成一个FindBug HTML报告从Maven
- 为什么我们在java中更喜欢原语和盒装原语
- JSP中的PreparedStatement对象操作数据库的使用教程