Liferay 7 Interview Questions
The following are some of the most frequently asked Liferay interview questions in the interview, here are the answers for them.
Q.1) What is a Liferay Portal?
Ans) In general, a web portal represents a web application that provides a single point of access to a variety of information.
The functionality of a portal can be extended very easily by creating custom applications that can run inside a portal. These applications are called portlets.
For running portlets, you need an application server that can run a portlet container spec (JSR168 or JSR286). There are dozens of free and enterprise portal products available.
Liferay portal is an open-source portal and below are the benefits of using Liferay portal:
- Content management system (Documents, Articles).
- 2-stage, 3-stage workflows, and publishing.
- Social networking. 4) Sites and organization basis pages.
- Integration with the third party like LDAP, Solr, SSO(CAS, Siteminder).
- Portlets related to Wiki's, News, Finance, Social, Workflow, Collaboration.
- Compatible with different Operating systems, databases and APP servers.
- Compatible with UI technologies and web services.
- Compatible with different scripts like PHP, Ruby, Grails, Python.
- Support of hot deployment feature.
Q.2) What is a Portlet?
Ans) Liferay portal comes with different portlets by default. These portlets are nothing but different small applications running in the instance (portal). Portlets are pluggable software components that are managed in a web portal.
In general words, you can call them as different catalogs as portlets produce fragments of markup code that are aggregated into a portal. So a portal page is displayed as a collection of the portlet, these multiple small applications together making a page of the site and these all pages together makes one community or enterprise portal. Hence a portlet (or collection of portlets) resembles a web-based application that is hosted in a portal.
A portlet is a small application to fulfill the requirement of a certain domain. Inter portlet communication is supported under the Liferay portal. Portlet supports the hot deployment feature of Liferay Portal.
Q.3)What is the Liferay portal and how it differs from other portals IBM WCM, Web logic?
- Liferay Portal is a platform contains common applications used to create a 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:
- User Management
Q.4) is Liferay is JSR-168 compliant or JSR-286?
Ans) JSR – 286
Q.5)Which all methods JSR-286 supports?
Q.6) Which JSR-286 portlet class extends?
Q.7) What class does LiferayMVCPortlet extend?
Ans)LiferayPortlet -> GenericPortlet
Q.8) What are the differences between Portlet and Servlet?
Ans) A Portlet container is built on top Servlet container.
Q.9)What is the difference between a Liferay Hook and Liferay EXT?
Ans) Hook: Hooks is a feature to catch hold of the properties and JSP files into an instance of the portal as if catching them with a hook. Hook plugins are more powerful plugins that come to complement portlets, themes, layout templates, and web modules. A hook plugin is always combined with a portlet plugin. For instance, the portlet social-portlet is a portlet plugin for Social Office with hooks. In general, hooks would be very helpful tools to customize the portal without touching the code part of the portal. In addition, you would use hooks to provide patches for the portal systems or social office products.
Source: Liferay Portal 6 Enterprise Intranets
EXT: EXT is used to customize and extend the Liferay portal. EXT builds a new ROOT web app and replaces it by a huge build mechanism your existing Liferay portal.
The Liferay EXT Environment is where you would ideally make changes to the portal itself. In other words, this is where you customize or “extend” the portal. You may ask, “Why can’t we just make the changes to the portal source directly?” The answer is that you technically CAN, but if and when you have to upgrade, you will have a tough time sorting out what is out-of-the-box and what is customized. EXT Environment keeps things separate.
Q.10)What is the difference between view and edit modes of a portlet?
Ans) View mode is what has displayed a user logs in to the Liferay portal and various portlets are displayed to him.
Edit mode is the configuration options that are displayed when the edit button is clicked on the portlet.
Q.11)What is service.xml and how will you use the Liferay service builder?
Ans) service.xml is a configuration file that consists of the details for database entities that are used in a portlet. The service builder uses the service.xml to generate the DAO/DTO classes for a portlet.
service.xml is also used by the Liferay server to create the database tables and columns for entities mentioned in service.xml.
Q.12) Can I run my Struts 1.3 based legacy application as a portlet application? How?
Ans) Yes it is possible to convert the legacy application into a portlet by making the legacy application to follow the requirements of a Liferay plugin and then deploying the same on the Liferay server.
Q.13) Do you know how to update your setup of Liferay 5.2.3 to Liferay 6?
Ans) Liferay website itself lists the steps for upgrading from 5.2.3 to Liferay 6. One should be though aware of how to take database backup and how to patch Liferay in general.
Q.14) What other portals have you heard of? How do you compare them to Liferay?
Ans) Other vendors have also rolled out portals which are reference implementation of JSR 286. The list includes:
Q.15) What is a Portlet Lifecycle?
Ans) Following is the portlet lifecycle:
Init(): It mainly initializes the portlet.
Render(): It takes the HTML output to User Interface. It mainly renders the view in term of JSP/HTML code and shows into the respective portlet.
Destroy(): This method takes care of releasing the portlet resources.
Q.16) What Is A Liferay Portal Instance?
Ans) Liferay portal ships with the one Liferay portal tomcat bundle which is up and running in any server with certain database settings. We can have more than one Liferay instance running from one database.
Liferay Portal allows you to run more than one portal instance on a single server. The Portal Instances page of the control panel lets you manage these instances. Data for each portal instance are kept separate. All portal data, however, is kept in the same database.
Each portal instance requires its own domain name. Liferay will direct users to the proper portal instance based on this domain name. So before you configure an instance, we need to configure its domain name in our network first. When we are ready to add an instance, click the Instances tab - > Add button.
It will be prompted for four fields and a checkbox:
- Web ID: A general convention is to use the domain name for this. It’s a user-generated ID for the instance.
- Virtual Host: Put the domain name you configured in your network here. When users are directed to your Liferay server via this domain name, Liferay will then be able to send them to the proper portal instance.
- Mail Domain: Enter the domain name for the mail host for this instance. Liferay will use this to send email notifications from the portal.
- Max Users: Enter the maximum numbers of user accounts you would like your portal instance to support.
- Active: Use this checkbox to choose whether to create an active or an inactive portal instance.
Q.17) How Can I Configure Two Different Domain Names (e.g. First.example.com And Second.example.com) On Liferay?
Ans) At the time of the creation of any site, we need to provide domain names that further take it as a site domain name. We need to provide a certain domain name as required through the control panel of Liferay portal. A single instance of Liferay Portal supports the hosting of two or more domain names via communities(sites).
When we will go to control panel -> Site settings -> we can provide the site URL, details like the site(community) description, membership type, active status, and virtual host.
Q.18) Which One Is Best To Start In A Clean Setup?
Ans) Liferay bundled with tomcat app server is the best one to start in a clean setup.
Liferay Portal Interview Questions
Q.1)How Can You Customize Liferay Search Feature? What Are The APIs To Do It?
Ans) We can customize Liferay Search feature, depends upon our requirement by below two ways.
Hook: If changes are required as per the view side like we need to change the search result from view then we can write the Hook to customize it.
EXT: If changes are required as per the core functionality like we need to change the search query term, we can implement EXT.
Q.2) How To Setup A Liferay Cluster From Scratch?
Ans) We need to setup below properties in our portal-ext.properties(this is for one instance represented by 1p, same properties we need to add for second instance also represented by 2p) and some required IP addresses.
#cluster configurations - these settings are for cluster
#other settings for cluster
Q.3)What is Use of <portlet:defineObject> and <liferaytheme:defineObject>?
Ans) These are Liferay tag libs and provide access to below list of objects in JSP:
- portlet:define object will provide following variables
- reader request and render response
- action request and Response
- event request and Response
- resourceRequest and Response
- portlet session
- portlet preference
- portlet preferences values
Liferay-theme:define object will provide following variables
Q.4)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
Q.5)What is the use of the PortletPreferences interface?
Ans) 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.
Q.6) 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 the action phase
- 2 means the server resource phase.
Q.7)What is the Portlet Namespace 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= getNamespace() %>