Recent Bloggers

Saurang Suthar
Posts: 5
Stars: 0
Date: 7/4/17
Jyoti Verma
Posts: 3
Stars: 0
Date: 6/28/17
Pankti Patel
Posts: 1
Stars: 0
Date: 5/26/17
Chandrika Baraiya
Posts: 5
Stars: 0
Date: 5/26/17
Atith Patel
Posts: 5
Stars: 0
Date: 5/22/17
Nisarg Pujara
Posts: 6
Stars: 0
Date: 5/10/17
Pranavsinh Parmar
Posts: 4
Stars: 0
Date: 5/3/17
Ankit Prajapati
Posts: 5
Stars: 0
Date: 5/3/17
Pratik Solanki
Posts: 5
Stars: 0
Date: 4/7/17
Chirag Patel
Posts: 4
Stars: 0
Date: 3/30/17
« Back

Override Liferay DXP/7 JSP Hook(Module)

Why create hook?

If you need to override the core JSPs from a module deployed to the OSGi runtime, you need a fragment module(Hook) which provides complete copy of the original JSP. In which you can make any modifications as per your requirements.

 

About this blog

In this blog, I have described steps to override a Liferay DXP/7’s JSPs. Please find jar file of fragment module at the end of blog for reference.

Prerequisite

Before starting this blog, basic knowledge about Liferay IDE and Liferay Portal is required.

 

Sample Problem:  Overriding login.jsp of com.liferay.login.web module using fragment module.

 

Override Liferay JSP: (Using blade CLI)

  • Here, I am going to override login page of liferay DXP/7. So, we need to create a fragment module for login page.
To create a fragment run following command in terminal under your liferay workspace.
 

blade create -t fragment -h <HOST_BUNDLE_SYMBOLIC_NAME> -H <HOST_SYMBOLIC_VERSION> <PROJECT_NAME>

 

  • Using Gogo Shell you can find  “HOST_BUNDLE_SYMBOLIC_NAME” and “HOST_BUNDLE_VERSION”.

Creating fragment

  • Run following command in your terminal.

blade create -t fragment -h com.liferay.login.web -H 1.0.7 my-login-jsp-hook

 

  • Make “login.jsp”  in ”/my-login-jsp-hook/src/main/resources/META-INF/resources” folder.

Copy source code of login.jsp from liferay portal and paste in your custom “login.jsp”. You can add your changes into this file.

  • Now build and deploy “my.login.jsp.hook.jar” on your Liferay DXP / 7 server.
                                 

Attachment

Jar file : login_jsp_hook.zip

Comments
No comments yet. Be the first.

Contact Us

Loading

Get in touch

Headquarter :
302, Landmark,
Nr. Titanium City Center,
Prahlad Nagar Road,
Ahmedabad, India - 380015.