Posts

Showing posts with the label creation of url

Creating URL in Javascript in Liferay

Sometimes it may requires to create URL in Javascript. In Liferay we can create any URL in Javascript.  In Normal Case we can create Action URL as            < portlet:actionURL var="testURL" name="update" /> In Javascript we create as           <aui:script>            AUI().ready('liferay-portlet-url', function(A){           var actionURL = Liferay.PortletURL. createActionURL ();          actionURL .setParameter("cmd", "test");            });          </aui:script>    To create renderURL we put as Liferay.PortletURL. createRenderURL() ; in above script.    To Create resourceURL we put as Liferay.PortletURL. createResourceURL() ; Refer "LiferayPortletURL" interface to get more idea. Apart from the setting the parameter(...

Creation of URL in class

Some times it may require you to create url in class. Its quite easy task to do , Here you follow as , ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest. getAttribute(WebKeys.THEME_DISPLAY); long plid = PortalUtil.getPlidFromPortletId(themeDisplay.getScopeGroupId(),<portlet-name>);          PortletURL portletURL = PortletURLFactoryUtil.create(actionRequest ,<portlet-name>, plid ,PortletRequest.RENDER_PHASE);          portletURL.setWindowState(LiferayWindowState.POP_UP);          portletURL.setPortletMode(LiferayPortletMode.VIEW);          portletURL.setProperty("portletName", <portlet-name>);          portletURL.setParameter("type", "add"); For Custom portlet name will be some thing as like this <name>_WAR_<name>