26 September, 2020
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:
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?
Ans)
Q.4) is Liferay is JSR-168 compliant or JSR-286?
Ans) JSR – 286
Q.5)Which all methods JSR-286 supports?
Ans) init(),render(),processAction(),processEvent(),serveResource(),destroy()
Q.6) Which JSR-286 portlet class extends?
Ans) GenericPortet
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:
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.
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 net.sf.ehcache.configurationResourceName=/myehcache/hibernate-clustered.xml dl.store.file.system.root.dir=/webapps/document_library_cluster #other settings for cluster liferay.home=/webapps/liferay-1p/liferay-portal-6.1.10-ee-ga1/ lucene.dir=/webapps/liferay-1p/liferay-portal-6.1.10-ee-ga1/data/lucene cluster.link.enabled=true lucene.replicate.write=true multicast.group.address["cluster-link-control"]=239.255.4.1
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:
Liferay-theme:define object will provide following variables
Q.4)Explain IPC(Inter portlet communication)?
Ans)
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?
Ans)
p_p_lifecyle holds integer value and represents the portlet lifecycle phase that portlet belongs:
Q.7)What is the Portlet Namespace and why it is important? how do you get portlet namespace in JSP?
Ans)
<% String nameSpace= getNamespace() %>
<portlet-namespace/>
TekSlate
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills .