Liferay JSP Hook

Liferay JSP Hook

Liferay JSP hooks are used to override  JSP,  java script, images etc.Lets create a simple jsp hook that override login.jsp from Liferay core JSP’s.

All web resource Hook configuration will in in custom-jsp-dir in liferay-hook.xml file like below:

  1. create hook plugin : In IDE, File -> New -> Liferay Plugin Project and select plugin type as Hook. 
  2. In eclipse, login-hook is created. right click on the project and select New -> File -> Liferay Hook Configuration
    • select Custom JSP’s from the Hook Types
    • click on Next
      liferay jsp hook configuration
  3. In this wizard, we can add the JSP’s file to override.
    • Click on Add from Liferay
    • search for login and login.jsp.  All JSP’s are listed are html/portal or html/portlet folders.
    • click Ok and click on FinishLiferay Hook tutorial
  4. Now it will create below project structure and add custom jsp entry to liferay-hook.xml file
    • liferay-hook.xml file
      •  <hook>
  5. Edit the login.jsp and deploy the login hook
  6. After deploying, It will rename the original login.jsp to login.jsp.portal and this new file will be loaded in the browser.
3 thoughts on “Liferay JSP Hook”

Leave a Reply

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