Search code examples
jspjakarta-eeliferayhookliferay-7

Overriding the login jsp in Liferay 7


In Liferay 7, I would like to override the login jsp.

As a first test, I've tried successfully to override the bottom-ext.jsp through the following link

https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/overriding-core-jsps

After that and because the login.jsp is not a core jsp in Liferay 7 but a module jsp, I've tried the following link :

https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/overriding-a-modules-jsps

But unfortunately after trying deploying* and starting, nothing has changed in my login view whereas I've added some custom html in the login.jsp file.

Does anyone has followed the previous tutorial successfully ?

For my failed test, I have :

  1. First retrieved the example project

https://github.com/liferay/liferay-blade-samples/tree/master/liferay-workspace/modules/blade.hook.jsp

  1. Next modified the login.jsp with custom html between lines 18 and 20

<p style="color: red">changed</p>
<h1>Hello World</h1>
<c:choose>

  1. The Liferay Module Project seems not be deployed* because nothing is written in the Eclipse console during deployment. Usually, with my other project modules, I have the following message :

16:31:49,741 INFO [pool-8-thread-2][BundleStartStopLogger:35] STARTED project.module_name_1.0.0 [864]

But not in this case...


Solution

  • hooks always remain in resolved state in liferay 7, Also when u deploy that hook, nothing seems to be coming on the log, seems to indicate that your login portlet version is different.

    Check your version in gogo shell & Replace it in this line in bnd.bnd

    Fragment-Host: com.liferay.login.web;bundle-version="1.0.0"
    

    When u deploy this, a message should come like stopped & started login.web, This is how JSP Fragments hook works.

    The latest Liferay IDE 3.1.0 (December Release) provides option to create JSP fragment hook, try that if you are facing issues via BLADE CLI.