Skip to main content

Posts

Showing posts from November, 2016

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()

Liferay 7 overriding MVC Commands

MVCActionCommand : An interface that allows the portlet to process a particular action request. By extending  BaseMVCActionCommand , we can customize processAction method. MVCRenderCommand : An interface that handles the render phase of the portlet. By   extending  BaseMVCRenderCommand , we can customize render method. MVCResourceCommand : An interface that allows the portlet to serve a resource. By  extending  BaseMVCResourceCommand , we can customize serveResource method. Now , we will see how to customize processAction method. Step 1: Initially, Create one module as mentioned in Liferay 7 document. Step 2: In controller class, write the component property depends on which modules you are customizing, for eg., if we customize create account page, write as following @Component( property = { "javax.portlet.name=com_liferay_login_web_portlet_FastLoginPortlet", "javax.portlet.name=com_liferay_l...