Basic Anatomy of Liferay Portlet

Article about file and folder structure of a basic Liferay portlet project.

In this post, we will learn about the main configuration files and the basic structure of the Liferay portlet.

To know about how to create a Liefary portlet, please check this post.

Version details: Liferay version 6.2.

Table of Contents

The liferay portlet structure

The portlet application project contains mainly four components. Those are docroot, WEB-INF, WEB_INF/src, and build.xml.

The below image shows a Liferay portlet project structure.


The below are the main files and folders of the portlet project.

docroot: This is the root folder of the portlet project. It also contains configuration and other files related to the application

WEB-INF: This is the standard WEB_INF folder of a web module. It also contains configuration-related files.

WEB_INF/src: The folder contains the source code of the portlet.

build.xml: The Ant build script file used to compile and deploy.

Note that the LDS IDE creates a new portlet project with the standard java portlet specifications.

A standard portlet application uses three separate JSPs for different modes(view, edit, and help).

Also, the LDS IDE adds only the view.jsp file for the newly created portlet project by default.

Portlet configuration files

Below are the Liferay related configuration files:

Liferay-display.xml: This file contains the category of the portlet application.

We also can specify the category of the portlet on this file.


Liferay-portlet.xml:  This file defines the portlet configurations. It describes the plugin to Liferay’s hot deployer.

We can also mention the required external dependency jars in this file.

Portlet.xml: This file contains the portlet-related configurations.

<portlet-name>: The tag specifies the portlet name.

Note that this name identifies the portlet within the portal application.

<display-name>: The portlet display name for the created portlet.

<portlet-class>: The action class for the Liferay portlet.

Note that we specify the required functionalities in this java class file.

<init-param>: The portlet’s initial parameters. It contains key-value pair.

We also can set the “view-template parameter with value as “html/view.jsp“.

<supports>: To specify the supported portlet modes(view/edit, etc).

The default portlet mode is the view mode.


In this article, we learned about the files and folder structure of a Liferay portlet project.

We also learned how to use configuration files to override the default portlet configurations.