• Overriding Module Apps JSP In Liferay 7 DXP

    Overriding Module JSP Apps JSPs In Liferay 7 DXP, Since Liferay 7 is completely restructured its OOB Portlets into Modularized OSGi Bunles of Modules, OOB Portlets are referred as Apps or Independent Modules. In my example i am going to Override the JSP of The Famous Login Portlet.

    Liferay Developer Studio/ IDE 3.1.2 GA3
    Liferay 7 CE/DXP Portal Tomcat 7 GA4
    JDK 8
    MySql 5.7

    Step 1 : Create a New Liferay Module Project Fragment

    Click On the New Wizard Button of the Liferay In The Liferay Developer Studio as in the above image.

    Give a Project Name, Build Type and Select Liferay Run time Environment and Click Next

    Step 2 : Select The OSGi Host Bundle To Override

    I am Overriding Login Portlet Which is available in the com.liferay.login.web Bundle, so Select the Module and Click OK

    Step 3 : Add Files From OSGi Bundle To Override

    There is an "Add Files From OSGi Bundle" Button in the right side of the window as shown above, Click on that button that List you all the JSPs in that Bundle to override as below.

    Select META-INF/resources/login.jsp as shown above, as we are overriding the login.jsp, If you want override any other jsp you can select the jsp from the list.

    Click Finish Button, This Will Create a Liferay Fragment Module Project For Login Portlet as shown in the below directory structure.

    Step 4 : Modify The JSP Of The OSGi Bundle

    Lets add some text into the login.jsp, i have added the text LIFERAY STACK LOGIN FRAGMENT at the top of the jsp page, lets deploy the login fragment module and test it. When you deploy the fragment bundle we can clearly see the com.liferay.login.web bundle is getting restarted

    Reload the Portal and Click on the Sign In Button of the Portal to See the Changes

    Awesome, Now you can modify the JSP of any App Module of Liferay DXP.
    Source Code


    Post a Comment