Welcome to Liferay Tutorial. Liferary is a JSR 286 complaint leading Portlet container. You can use liferay portlet for creating an enterprise, standard and scalable Web Application.

Liferay Tutorial

There are different types of Portlet containers such as Apache Pluto, Oracle Web center and Liferay. This tutorial is intended to provide you a full detailed explanation for getting Liferay Portal up and running and deploy the same employee registration sample that we had developed in earlier tutorial.

Generally, you may find some difference between Apache Pluto and Liferay but actually, a lot of work has already done on behalf of you when it comes to develop a Portlet using Liferay.

Liferay has also supported different types of Portlets as well as added others, Standard Portlet, JSF, Liferay MVC are mainly used with Liferay.

Liferay Tutorial Project Structure

Find below the full structure for the sample developed below:


Liferay Eclipse Plugin

To make Liferay Portlet development much easier, an Eclipse Plugin should be installed. This plugin will help you creating Liferay Portlet with its proprieties to be deployed smoothly later on. Following below steps will help you install it:

  • From Help menu inside your Eclipse IDE, select Install New Software.
  • Past this URL https://releases.liferay.com/tools/ide/latest/milestone/ inside Work With input.
  • Click next and accept the terms and conditions.
  • Click finish.

Download Liferay

Downloading of Liferay Portal isn’t much hard mission, just you may follow the below steps to make sure you have proper Liferay Portal installed up and running using your Eclipse.

  • Download latest Liferay Portal from this link.
  • Unzip the downloaded into your directory.
  • Restart your Eclipse and make sure you’re able of defining a new Liferay Server.
  • Liferay-Ability-of-Defining-a-Liferay-Portal-Server
  • Click next and browse towered you unzipped Liferay.
  • Click next & finish.
  • Start the server from Servers pane.
  • Waiting till the server get started and the browser open on https://localhost:8080/.
  • Fill in all required information before finish the configuration.
  • Liferay-Fill-In-Configuration-Details-1024x552
  • Click finish configuration.
  • Once you’ve configured it successfully, click Go to My Portal.
  • Accept the terms by clicking on I Agree.
  • Enter your password that will be used for logging into your Portal later on and click on save.
  • Select the password reminder question and type its answer and click save.
  • Liferay-Install-Liferay-Plugin

Create Liferay Plugin Project & Portlet

We will use the Liferay plugin to get an instance of Liferay JSF Portlet and develop an employee registration form. This form is already done through wide range of Portlet containers and Portlet types. The same sample would be introduced using the Liferay Portal and its proprietaries.

Following below required steps for creating this Portlet:

  • From your Project Explorer, Right-Click and select New.
  • From the Select Wizard, liferay menu, select Liferay Portlet & Click next.
  • When eclipse asked you if you would to open new liferay Plugin Project Wizard, just answer yes. That lets you creating a Liferay Portlet as a Liferay Plugin.
  • From the shown wizard, fill in all the required information.
  • Liferay-Create-Portlet-By-Using-Liferay-Plugin
  • Determine the active profiles that you’ve set above by clicking on Create New Maven Profile Based on Liferay Runtime button that’s beside the Active Profiles input.
  • Liferay-Create-New-Maven-Profile
  • Click next & select JSF 2.x.
  • Liferay-Create-Portlet-Select-Portlet-Framework
  • Click next and select the JSF component suite. Mainly, we’ve used a JSF Standard Implementation.
  • Liferay-Select-JSF-Suite
  • Click finish & bypass the Portlet creation wizard that’s displayed after then.

Database Design

Database design isn’t vary differ from what already we provided before in the previous JSF sample. It’s just a simple Employee Table that shows like below:

And you can find below used SQL query to get Employee Table created into your database:

Employee Model

Typically, your data shouldn’t be passed individually, and so a model must be defined for this purpose. Employee model will be like normal Java class below:

Managed Bean

According for JSF implementation, a managed bean is used to hold all the presentation logic that you may embed inside your view. In our case, an employee should be saved against our database, hence, our managed bean has defined a registerListener method that’s responsible for saving the entered Employee.

However, you may find an instance of your Employee but there’s no snippet of code has responsible for linking entered data with it. This is a JSF implementation responsibility and so you should focus into your business needs instead of got involved with adhoc work.


You may also find @ManagedBean & @SessionScoped annotations which provided by the JSF implementation to define a new managed bean and determine the scope of it, respectively.

JSF View

We only have a single view that’s responsible to allow you enter employee’s information and notify you if your operation get finished successfully or something went wrongly.


Here’s below the detailed explanation for the code listed above:

  • Employee’s Identifier is required, if you omitted it, the form should notify you.
  • Employee’s Identifier should be set of numbers.
  • Employee’s Salary is required and it also should be set of numbers.
  • Employee’s Salary must be formed of 2-4 digits.
  • Messages component will help you getting notified by the status of your operation.
  • Register submit action should provide you facility of sending entered information to be saved after then.

EmployeeDAO & Database Utility

EmployeeDAO and ConnectionUtility have been used each together for handling all the database missions. EmployeeDAO is responsbile of saving an employee while the database connectivity is handled by ConnectionUtility.

Registration Demo

The demonstration assumes that you have an installed Liferay Portal up and running and you can access it through using of https://localhost:8080 and you can enter your mail and password to log into your Dashboard.



From the right top corner, expand the menu that’s beneath your name and navigate into your dashboard.


Browsing of your dashboard will make you able of adding, removing and modifying your Portlets. From the Plus button in the most left top corner you can add your Portlet. But before adding your Portlet into your dashboard, just make sure you were deploying it.

Once you’re clicking on Plus button, a new pane has been viewed and set of tabs are shown. Make sure you’re selecting the applications and expand the Sample node.


Drag JournalDevPortlets into your dashboard


If you’ve tried to submit an empty form, you should find an error message that notify you about what’s went wrongly and needs your involvement.


Fill in all the information required and try to register


And finally, you should be able of seeing the employee registered inside your database.



We’ve introduced a lot of Portlet containers a long side of different tutorials had published on JournalDev. Due to Liferay Portal maturity and good reputation of it, this tutorial is an example that shows you how can you install and deploy a JSF Portlet into Liferay Portal.

Contribute us by commenting below and find the downloaded source code.

By admin

Leave a Reply

%d bloggers like this: