Liferay Intro and Creating a New Portlet in Liferay

5 min readNov 9, 2021

What is Liferay?

Liferay 7 is the current version of Liferay brought many features. Liferay 7 we call it “Liferay Digital Experience Platform”.

We can create and personalize the content and which can be experienced in any personal digital device such as ‘computers’,’ laptops’, and ‘mobiles’.

Liferay 7 platform provides a rich interface to publish websites based on our business needs and it can be experienced across all digital devices.

Server Configuration:

Click on the available link to create a new server.

Creating a New Server

Go to Liferay and configure Liferay7.x as shown in the figure. Then click on the “Next” button.

Choose Liferay 7. x

Set the path of your local directory where you have extracted Liferay port Tomcat.

Note: Liferay 7 requires complete” jdk8" not just jre8 so click on installed JRE and configure your JDK as shown in the figure.

Configure the JDK

Click on Add jdk1.8.0_161

Add jdk1.8.0–161

Select Standard VM and click on Next.

Then give the path of your JDK1.8.0_161 and click on the Finish button.

Now select the available JDK option and click on the Finish button.

Now set the Eclipse folder to “Liferay Workspace” as shown in the below figure.

Now we are going to start creating the sample program by using the Liferay7.To Create the Project, the following steps are shown below:

Now GoTo File -> New ->click on the Liferay Module project.

A new popup window appears and you have to fill in some information about your project like the below figure. (i.e., Enter the name of the workspace, and the download Liferay bundle must be unchecked since we have already downloaded the Liferay bundle. Click on Next).

Next, enter the Component class Name and package Name of the Liferay module as shown in the below figure. Then click on the “Finish” button.

This was the created project structure in your workspace as shown in the figure.

Structure of the Project

The Structure of the project created by the Gradle or maven tool is the same. Java code and the resources are separated. It is easy to code to manage.

Let’s take a look, you do not see some familiar files like portlet.xml, Liferay-portlet.xml và Liferay-display.xml. Where are they? Next, we will review the content of the TestPortlet class.

And also in that “src/main/resources” folder, Go to the “View. JSP” page edit the data that data will display in google chrome as we have shown in the below figure.

Now we can run the project, i.e., on the right side of the bar, we have the project structure. Open that the structure in that we have a “build” option. Go to the “build” option in that we have “deploy” double on that deploy as we have shown in the below figure.

Now go to the main project folder, in that folder structure we have a bundle option.

Then GoTo the bundles -> OSGi -> modules -> in that we have one Zip folder copy that folder as we have shown in the below figure.

After copying that we want to server of the tomcat server. In that Tomcat server, we have a deploy option in that deploy we want to paste that zip folder in that deploy option as we have shown in the below figure.

The deployment will be complete automatically. Open your browser and drag your portlet on your page. Let’s click on the “+” button on the top-right browser.

After clicking on the “+” it shows all the applications as shown in the below figure. Now click on the “Applications” it will show the “category. Gollakalyani” opens that file. Now click on the Add option as shown in the below figure.

Now it will be displayed as shown in the below figure.

The final output of Code