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.


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

8 thoughts on “Liferay DXP JSP HOOK”
  1. 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,

  2. 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.

    -Pankaj Shet

  3. 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 ?

  4. hi thanks for giving the tutorial, the tutorial you made is very good and can be used easily. can you create a tutorial to change authentication with phone number in expando column? thank before

  5. Thank you for your post, I would like to override aui:select tag and add more parameters, because aui:select overrides our third party js, but I still want validation and security from AUI, is there any way to do it without tweaking the source code?

Leave a Reply

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