Display Liferay portlet inside other liferay portlet

牧云@^-^@ 提交于 2019-12-10 12:19:09

问题


I use Liferay portlet bundle 6.2 (Tomcat) and Liferay IDE(eclipse). I created two Liferay Plugin Project. In the first portlet(first plugin portlet), I save some data by using Portlet Preferences. Now, I will display second portlet in first portlet. How I can do that? I found this following code and this Link

Open portlet from other portlet

    var url;
function createRenderURL(portletId) {       
AUI().ready('liferay-portlet-url', function(A) {
    var renderURL = Liferay.PortletURL.createRenderURL();
    renderURL.setName("test");       
    renderURL.setWindowState("pop_up"); 
    renderURL.setPortletId(portletId);           
    url = renderURL.toString();
});}

But, I don't unterstand this code? I add this code to view jsp, where I can found portletId? Please, can someone explain me this a little bit? I'm new in Liferay


回答1:


It depends if your portlet is instanciable or not.

Not instanciable: your portletId should looks like Weather_WAR_WeatherPortlet

Instanciable: your portletId should looks like Weather_WAR_WeatherPortlet_INSTANCE_5aSc

You can check portletId on the table "portlet" inside your database.

If you want to get it by programmation you should use PortletConfig class

((com.liferay.portlet.PortletConfigImpl) portletConfig).getPortletId() 

NB: portletId which are number are Liferay portlet



来源:https://stackoverflow.com/questions/33276042/display-liferay-portlet-inside-other-liferay-portlet

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!