Liferay Portlet Basic Interview Questions

 # What is Portal?

Portal is platform to create web applications where portal provides commonly used features such as user  management, authentication, sites, web content management to avoid creating from scratch. Portal assembles multiple portlet applications to form a page

# What is Portlet?

Portlet is single application fragment on Portal

#What is Liferay portal and how it differs from other portals IBM WCM,Web logic?

  • Liferay Portal is platform contains common applications used to create web application
  • Liferay provides a development framework with highly customization components for building a site.
  • Liferay Portal can be used for content management, be it web content management
  • Liferay Portal offers a rich collaborative application suite with:
    • Calendars
    • Blogs
    • Wikis
    • Workflow
    • User Management

# What are differences between JSR-168 and JSR -286?

JSR – 168JSR-286
Portlet 1.0 SpecificationPortlet 2.0
Does not support IPCSupports IPC through events and public render parameters
No support of serviceResource() methodincluded servetResource method to load resources dynamically
No Support of Portlet filtersIncluded portlet filters

# is Liferay is JSR-168 compliant or JSR-286?

JSR – 286

#Which all methods JSR-286 supports?


#Which JSR-286 portlet class extends?


#What class LiferayMVCPortlet extends?

LiferayPortlet -> GenericPortlet

#What are the differences between Portlet and Servlet?

A Portlet container is built on top Servlet container.

Portlets renders part of HTMLServlets renders complete HTML document
Portlets does not generates complete HTML document and it is just fragmentServlets will geneate whole HTML document
Portlets are managed in portlet containerServlets are managed in Servlet container
Portlets can not be accessed URL and portlet should be placed on portlet page to accessServlets can be accessible with URL
Portlets supports CHTML,WML,XHTML content types onlyServlets supports generatins of all content types
Has three types of requests: render, action,resourceHas Single type of action called : HttpServletRequest
Portlets can define window states and modes/td>Servlet can not difine window states and modes

 #What is Portlet Name space and why it is important ? how do you get portlet namespace in JSP?

  • Portlet namespace is portlet Id
  • p_p_id parameters also contains portlet namespace
  • portlet name space is prefixed with url parameters, so that portlet container will identify the parameters belongs what portlet
  • In  JSP:
    • <%  String nameSpace=  renderResponse.getNamespace() %>
    • <portlet-namespace/>

#In Portlet URL, what is p_p_lifecycle?

p_p_lifecyle holds integer value and represents the portlet lifecycle phase that portlet belongs:

  • 0 means render phase
  • 1 means  action phase
  • 2 means server resource phase.

# In Portelt URL, what is p_p_state?

p_p_state is  window state of portlet and will be one of normal, maximized and minimized

# How to get ServletRequest from PortletRequest Object?

# Explain Portlet Life cycle?

Access below link for complete details on Life cycle:

Liferay portlet basics and lifecycle

 What is Portlet? a portlet is fragment on a webpage as web application and is used with portlets on the same webpage. There are 2 JSR standards for portlet behavior: JSR 168 (Portlet 1.0 specification):   READ MORE

# What are portlet modes?

Access below tutorial for complete details:

Liferay portlet modes

What is Portlet mode? Portlet modes are used to indicate what functions are they are doing currently. The portlet modes are defined in portlet.xml file. Java Portlets supports  3 portlet modes : view edit help Liferay added…READ MORE

# What are window states?

Access below tutorial for window states:

Liferay window states

 What is window state: window state indicate the amount of space taken by the portlet All java supported portlets have the below modes: Minimized: only portlet title bar is displayed when user clicks Maximized:The portlet occupies entire…READ MORE

# Explain possible ways of creating renderRequest  in JSP and controller?

Using Response Objects


Using Portlet and liferay-portlet tag libs

<portlet:renderURL var="viewUser" >
 <portlet:param name="mvcPath" value="/html/createuser/viewUser.jsp" />
<portlet:actionURL var="deleteUser" name="deleteUser" >

Using PortletURLFactoryUtil

PortletURLFactoryUtil.create(PortletRequest portletRequest, String portletId, long plid, String lifecycle)

# How to validate Form in JSP?

Liferay provides AUI Tag library to validate form elements

 <aui:input name="customerEmailAddress">
 <aui:validator name="required" errorMessage="This is required attribute"></aui:validator>
 <aui:validator name="email" errorMessage="Enter valid Email"></aui:validator>

The below are AUI out of the box validators for input fields:

acceptFiles ,alpha ,  alphanum , date ,digits , email ,equalTo ,max ,maxLength ,min,minLength,number ,required,url

# What is Use of <portlet:defineObject> and <liferaytheme:defineObject>?

These are liferay tag libs and provide access to below list of objects in JSP:

portlet:defineObject will provide following variables

  • renderRequest and renderResponse
  • actionRequest and Response
  • eventRequest and Response
  • resourceRequest and Response
  • portletConfig
  • portletSession
  • portletSessionScope
  • portletPreference
  • portletPreferencesValues

liferay-theme:defineObject will provide following variables

  • themeDisplay
  • company
  • user
  • realUser
  • contact
  • layout
  • layouts
  • plid
  • layoutTypePortlet
  • portletGroupId
  • permissionChecker
  • locale
  • timeZone
  • theme
  • colorScheme
  • portletDisplay

# What is expiration cache defined in portlet.xml ?

# Explain IPC(Inter portlet communication)?

  • Portlet 1.0 did not offer any standard method for portlets to communicate with each other
  • Portlet 2.0 (JSR – 286 ) addresses this issue with 2 different mechanisms for IPC.
    • Public Render Parameters
    • Portlet Events

# What property is used to publish event to all portlets on different pages in


# Which property is used to publish event to all portlets on different pages ?


# What is the use of the PortletPreferences interface?

Portlet Preferences are properties for storing basic portlet configuration data. Administrators often use preferences to provide a customized view of a portlet to users based on preferences.

Click here to for complete details:

# Why are friendly URL’s important?

Access below tutorial for friendly URL’s

Liferay friendly url

Liferay Friendly URL In this tutorial, we will see how to make Liferay URL to  friendly. Liferay generates lengthy URL’s for render,action,resource which looks clumsy and not readable and add below URL parameters which are not required.: p_p_id p_p_col_id –…READ MORE

#How to change default landing page in Liferay?

 # Set the default landing page path for logged in users relative to the
 # server path. This is the page users are automatically redirected to after
 # logging in. For example, if you want the default landing page to be
 # http://localhost:8080/web/guest/login, set this to /web/guest/login. To
 # activate this feature, set to true. To customize
 # the behavior, see in
 # the "" property above.
 # The following variables can be used: ${liferay:screenName} and
 # ${liferay:userId}.

Leave a Reply

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