Portal Properties and Portal-ext Properties in Liferay

Portal properties are configuration points from where we can change behavior / functionality of liferay portal.
Liferay provides many portal properties which can be used to set up & configure Liferay portal.
When we configure liferay server first time, it will create portal-setup-wizard.properties file under <<Liferay-tomcat-bundle>> folder as per below screenshot.
Portal Properties and Portal-ext Properties in Liferay - Configuration_zip
This file contains following configuration information.
admin.email.from.name=Test Test
liferay.home=C:/Liferay Developer Studio 1.5/resources/liferay-portal-6.1.10-ee-ga1
[email protected]
[email protected]

Liferay defines few more portal properties in portal.properties file. This file is located in <>/tomcat-7.0.25/webapps/ROOT/WEB-INF/lib/portal-impl.jar. We can override these properties (defined in portal.properties) from portal-ext.properties file.

portal-ext.properties file needs to be created manually and can be placed at following places

Location-1 : <<Liferay-Tomcat-Bundle>>/ folder
Location-2 : <>/tomcat-7.0.25/webapps/ROOT/WEB-INF/classes.

On server startup, Liferay reads portal properties from portal.properties file followed by portal-ext.properties file defined at location-1 then from location-2. Finally, it reads from portal-setup-wizard.properties file.

This means, 

  • Any property defined in portal.properties file, can be overridden in portal-ext.properties defined at location-1.
  • Any property defined in portal-ext.properties file at location-1, can be overridden in portal-ext.properties defined at location-2.

We can either override existing properties and / or can define new properties  in portal-ext.properties file.

Portal properties

Let’s see this in action.

Follow blog to configure Liferay source in eclipse / Liferay Developer Studio.

Once Liferay source is imported, press Ctrl+Shift+R and type portal.properties file as per below screenshot.

Portal Properties and Portal-ext Properties in Liferay - Open_Portal.properties

Click on the Open button and search for company.default.name property. It has the following value


we will override this property from portal-ext.properties file.  Create portal-ext.properties at <<Liferay-Tomcat-Bundle>> folder as per below screenshot. 

Portal Properties and Portal-ext Properties in Liferay - location-1

Add following content to it.

test.property=Abc Corporation

Here we are overriding existing property company.default.web.id and added new (custom)property test.property with value Abc Corporation.

Create one more fie with same name (portal-ext.properties) at <>/tomcat-7.0.27/webapps/ROOT/WEB-INF/classes path and add following content to it.


test.property=Pqr Ltd

portal-ext.properties file placed at <>/tomcat-7.0.27/webapps/ROOT/WEB-INF/classes will be read last and hence it overrides all properties defined in portal.properties and portal-ext.propeties (defined at <<Liferay-Tomcat-Bundle>> folder).

We will read these properties from Portlet. Follow my previous blog to create Liferay MVC portlet. Give its name as ‘portal-properties-check‘ and ‘-portlet‘ will be appended by Liferay at the end.

I gave Portlet class as ‘com.opensource.techblog.portlet.PortletPropTestPortlet‘. It will look like as per below screenshot

Portal Properties and Portal-ext Properties in Liferay - Project_structure

Add following content to portlet class

 public void render(RenderRequest request, RenderResponse response)
   throws PortletException, IOException {
  String newProp = PropsUtil.get("test.property");
  String existingProp = PropsUtil.get("company.default.web.id");
  request.setAttribute("newProp", newProp);
  request.setAttribute("existingProp", existingProp);
  super.render(request, response);


  • We have an override render method that will be called when this portlet gets rendered on Liferay page.
  • In this method, we are reading properties defined in portal.porperties (or portal-ext.properties) by util class called PropsUtil.get() method. We are passing Key of property. This method will return value (in form of ‘String‘ if present) or null if the property is not defined.
  • We are setting properties value in request attribute which will access it in view.jsp

open view.jsp and add the following code in it.

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>

Existing Property is <b>${existingProp}</b>
New Property is <b>${newProp}</b>


  • In view.jsp file, we are showing the value of properties by EL.
Note:- We must have to restart the server to reflect any changes done in portal-ext.properties file.
Since we have placed portal-ext.properties file the first time, restart the server (if it’s already running). Once the server is restarted, then deploy the portlet and place it on some Liferay page. You will see the following output.
Portal Properties and Portal-ext Properties in Liferay - output-1
As you can see the values of the above properties are coming from portal-ext.properties defined at <>/tomcat-7.0.27/webapps/ROOT/WEB-INF/classes location. It overrides properties defined in portal.properties and portal-ext.properties (defined at <<Liferay-Tomcat-Bundle>> folder) file.
Now, remove ‘test.property=Pqr Ltd‘ property from portal-ext.properties file located at <>/tomcat-7.0.27/webapps/ROOT/WEB-INF/classes path and restart the server. This time you will see the following output.
Portal Properties and Portal-ext Properties in Liferay - output-2
Note that, value of ‘company.default.web.id‘ property is still coming from portal-ext.properties file defined at <>/tomcat-7.0.27/webapps/ROOT/WEB-INF/classes but the value of ‘test.property‘ is coming from portal-ext.properties at <<Liferay-Tomcat-Bundle>> location, since we have deleted it from portal-ext.properties file located at <>/tomcat-7.0.27/webapps/ROOT/WEB-INF/classes.
This means, portal-ext.properties file located at <>/tomcat-7.0.27/webapps/ROOT/WEB-INF/classes always read last and override all properties from portal.properties and portal-ext.properties defined at <<Liferay-Tomcat-Bundle>> folder.
Play with some other properties by overriding and displaying it from portlet.
You can find more properties defined in portal.properties from Liferay site.
I would recommend looking at the index page ‘A Complete Liferay Guide‘ to browse all topics about liferay.


Download Source
Download Source

Recommended For You

About the Author: Nilang

Nilang Patel is a technology evangelist who loves to spread knowledge and helping people in all possible ways. He is an author of two technical books - Java 9 Dependency and Spring 5.0 Projects.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.