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>

Comments

Post a Comment

Popular posts from this blog

Theme display in javascript

How to know which liferay version we are using

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate