Monday, 25 September 2017

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?

init(),render(),processAction(),processEvent(),serveResource(),destroy()

#Which JSR-286 portlet class extends?

GenericPortet

#What class LiferayMVCPortlet extends?

LiferayPortlet -> GenericPortlet

#What are the differences between Portlet and Servlet?

A Portlet container is built on top Servlet container.
PortletsServlet
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?



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

Using Response Objects
renderResponse.createActionURL();
renderResponse.createRenderURL();
renderResponse.createResourceURL()
Using Portlet and liferay-portlet tag libs
<portlet:renderURL var="viewUser" >
 <portlet:param name="mvcPath" value="/html/createuser/viewUser.jsp" />
</portlet:renderURL>
<portlet:actionURL var="deleteUser" name="deleteUser" >
</portlet:actionURL>
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>
 </aui:input>
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 portal-ext.properties

portlet.event.distribution=layout-set

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

public.render.parameter.distribution=layout-set

# Why are friendly URL’s important?

Access below tutorial for friendly URL’s

#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 auth.forward.by.last.path to true. To customize
 # the behavior, see com.liferay.portal.events.DefaultLandingPageAction in
 # the "login.events.post" property above.
 #
 # The following variables can be used: ${liferay:screenName} and
 # ${liferay:userId}.
 #
 default.landing.page.path=
 #default.landing.page.path=/web/guest/login
 #default.landing.page.path=/user/${liferay:screenName}/home

TEST

I am Java Developer. I have 6 year Experiance in this field and like to post in blogging. So keep sharing and like my post

0 comments:

Post a Comment

 

Copyright @ 2017 Liferay Article.