XML Configuration Files

XML Configuration Files 

We should have clear understanding of below XML files before developing any portlet in Liferay.

1) portlet.xml

2) liferay-portlet.xml

3) liferay-display.xml

These three files are the backbone of liferay portlet. Lets explain each of the files

portlet.xml:

This file basically contains portlet name, display name, portlet class, initialization parameters and many more. Some of the important tags of this file are <portlet-name/>, <display-name/>, <portlet-class>. For example

<portlet-name>Sample Portlet</portlet-name>
<display-name>Demo </display-name>
<portlet-class>com.liferay.util.bridges.mvc.MVCPortlet</portlet-class>

The portlet-class tag may contain built in Liferay MVC Portlet or it can be our custom class. We can develop portlet by Liferay MVC or  by Spring MVC or by JSF and so on. By inspecting portlet-class tag we will be able to identify the nature of the portlet

liferay-portlet.xml:

In this file we can define css, js files required for the portlet. We can also define whether a portlet is instanceable or not. Set the instanceable value to true if the portlet can appear multiple times on a page. If set to false, the portlet can only appear once on a page. The default value is false.

 liferay-display.xml : 

This file is used for categorization of the portlet. We can create our own category as needed. For example

<display>
<category name=”Pro Liferay”>
<portlet id=”sample” />
</category>
</display>

Here the sample portlet will be listed in Liferay under “Pro Liferay” category.

Scroll to Top
%d