Search code examples
liferayliferay-7

How to Override Login JSP in Liferay?


I am trying to customize login.jsp of liferay. I know this question has been answered previously. But I am struggling to understand which approach to follow.

First, I came across this article. It's recommended here not to use fragment approach for core JSPs.

Then I explored These two approaches:

  1. Customizing JSPs with Dynamic Includes.

  2. JSP Overrides Using Portlet Filters.

Here they have included the code in java file not in JSP. I checked the examples on Github included in these articles there also same thing no JSP file. Since I have already created my own method for login and created a login.jsp for that I want to do the customization in JSP file itself.

Finally, I came across this article. Module JSP Override In this they have mentioned since login.jsp is not a core but a module JSP so we can use this approach(fragment one).

But I am not able to create Liferay Module Project Fragment. I am getting this error.

enter image description here

I tried setting path in my gradle.properties like so.

liferay.workspace.home.dir = "C:\Users\thisPC\Desktop\Liferay\liferay-ce-portal-7.1.2-ga3"

But still the same thing.

Can anyone suggest which approach to follow for overriding login.jsp in liferay and include a small example of how to do it. Thanks.

Please feel free to edit or ask question if i am not able to explain my problem properly.


Solution

  • My best guess is that the backslash escapes the following characters. Even on Windows: Java works well with forward slashes. Try using "C:/Users/thisPC/Desktop/Liferay/liferay-ce-portal-7.1.2-ga3" and make sure there's no typo (e.g. that this directory exists)

    In case the IDE does not look at the Liferay Workspace configuration, but directly at the workspace, you might want to try keeping your bundle directly in the workspace (its standard location) and automatically download it through gradle initBundle.

    And last, but not least: As it seems to be a problem with just the project creation wizard: You can also start with the blade sample for such a project. Naturally, you'll then have to locate the overridden jsp, module etc yourself, and adjust all the configuration. But as the sample project is small, it's easy to inspect every single file it contains for required updates.

    Incidentally, the blade sample linked already overrides the login.jsp, but I'd suggest copying over the original one instead of using this sample.