Liferay DXP JSP HOOK

Liferay DXP JSP HOOK drive you about Liferay JSP override in Liferay 7 or  Liferay DXP. Liferay 6 and below versions uses web resouce HOOK to modify the JSP’s, images, java scripts.In Liferay DXP or Liferay 7 uses OSGI Fragment Host desgin pattern to modify the resource.

Installations

Liferay DXP Login JSP Hook Tutorial

Hope you have already configured Liferay DXP development environment. Let’s modify login.jsp file

  • Create New Liferay Fragment Module Project. Click  File-> New -> Liferay Module Fragment Project and give the project nameLiferay DXP Hook Tutorial
  •  In this wizard,  we need to select what HOSt OSGI Bundle. so click on Edit icon right to Text field
  • Search for *login and select “com.liferay.login.web-1.1.3.jar” that contains login.jsp resource.
  • In the Overridden files, click on + icon and select login.jsp file and click on Finish.
  • Project structure will look like below:
  • bnd.bnd file will contain fragment host details like below:
    • Bundle-Name: org.javasavvy.demo.hooks
      Bundle-SymbolicName: org.javasavvy.demo.hooks
      Bundle-Version: 1.0.0
      Fragment-Host: com.liferay.login.web;bundle-version="1.1.3"
  • Edit the login.jsp and add “Liferay DXP Hook DEMO” on top
  • build the module and deploy. you may required to copy bundle manully to  liferay-home/deploy folder if you configure tomcat outside of liferay workspace
  • Now click on Sign and you will be able to see your changes.

 

 

You will get below exception, which means you need to upgrade liferay to latest fix-pack. i,e “liferay-fix-pack-de-8-7010”

org.osgi.framework.BundleException: Invalid operation on a fragment.

Click here to download the Liferay DXP Hook Example

6 Comments

  1. Thirumal Reddy

    Hi,
    I am using Liferay 7 GA2.
    and I am using liferay-ide-eclipse-windows-x64-3.0.1-ga2-201606151031

    i am not getting Liferay Module Fragment Project,
    when i click on File->new,

    Reply
    1. Jayaram Pokuri (Post author)

      Hi Thirumal,

      Download the Latest Liferay IDE. Module Fragment is not avaible in Liferay GA2 and it is M1.

      https://sourceforge.net/projects/lportal/files/Liferay%20IDE/3.1.0%20M1/

      Regards,
      Jayaram

      Reply
  2. Pingback: Liferay DXP Hooks,Liferay 7 Hooks Tutorials,Liferay 7 Hook examples

  3. Rajan

    Hi i want to add OTP in Liferay DXP …if you have any idea about Login Hook please suggest.

    Reply
  4. Pankaj Shet

    Hi Meera,

    I tried to implement the hook according to the above steps , but its not working , it shows the red cross sign indicating some error when deployed in the bundled tomcat server , Request your help here.

    Regards,
    -Pankaj Shet

    Reply
  5. sanket

    HI ,
    Nice article for JSP overriding in liferay 7.

    I want to overrride the “terms_of_use.jsp” file in liferay 7 .

    This file is showing in the “com.liferay.portal.kernel-2.0.0.jar” but this jar file is not shown into the OSGI Bundle list.

    Can you help me to solve this ?

    Reply

Leave a Reply to Thirumal Reddy Cancel reply

Your email address will not be published. Required fields are marked *