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.
- Liferay Eclipse IDE (Download latest version): Click on that to download latest M2 Version which has Liferay Module Fragment
- Liferay Bundle Tomcat : Download the latest bundle from source forge
- MySQL 7
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 name
- 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.