Creating PortletURL in Javascript
At times, we are supposed to create PortletURL in Javascript. We can do like this as follows. <aui:script use = "liferay-util-window,liferay-portlet-url" > var portletURL = Liferay.PortletURL.createRenderURL(); portletURL.setPortletId(' <%= PortletKeys . SOME_PORTLET %>'); portletURL.setPlid(15932); portletURL.setWindowState(' <%= LiferayWindowState . POP_UP . toString () %>'); portletURL.setParameter('param1', param1); portletURL.setParameter('param2', param2); portletURL.setParameter('mvcPath', '/html/my_portlet/my_page.jsp'); // Now we can use the URL console.log(portletURL.toString()); </aui:script> Similarly you can also create other URL type as needed: Liferay.PortletURL.createActionURL() Liferay.PortletURL.createPermissionURL() Liferay.PortletURL.createResourceURL() Liferay.PortletURL.createURL()