The largest Interview Solution Library on the web

Interview Questions
« Previous | 0 | 1 | 2 | 3 | 4 | Next »

1.What is a portal ?

A portal can be best described as a web site that acts as a "point of entry" or a gate to a larger system. While it seems pretty difficult to define a portal in the strictest sense, these are some of the common features of portals:

  • Content aggregation:
    Portals tend to aggregate content from multiple, disparate sources and provide one unified view of the same.
  • Personalization:
    This refers to the ability of the portal to tailor the content/services that it offers according to the user of the portal.
  • Search:
    Most if not all portals, offer some form of searching of it's content and sometimes even content from external sources.
  • Single Sign On:
    Allows users to authenticate once to the portal and thereby allows access to many other systems without the need for re authentication.

2.What is a JSR 168 Portlet ?

Prior to JSR 168, almost all portal platforms offered their own proprietary approach to create pluggable portal components. For example, IBM had IBM portlets, Sun(iPlanet) had Providers, SAP had iViews and Plumtree had Gadgets.
JSR 168 aims to standardize these pluggable portal components so that they are independent of the actual portal server that they are written to. What this means is that one can migrate portlets seamlessly from one portal server to another without any code change.

3.What are the types of request in JSR 168 portlets?

Their are two types of request :-

  • RenderRequest
  • ActionRequest

4.What are the differences between portlets and servlets?

Essentially, Servlets provide content that normally takes up the whole page in a browser (unless you're using frames), and portlets provide content that is wrapped by a window. With portlets, you can have multiple portlets side by side with one another and each one can provide content and functionality that is different from the other. A portlet can provide the complete interaction for one type of application, while another portlet can provide content for another type of application. The portal can provide some house keeping functionality and secured single point of entry to all of the portlets on a page. As for the particulars (similarities/differences) between them, please continue reading.
Here are some similarities:

  • Servlets and portlets are web based components that utilize Java for their implementation
  • Portlets are managed by a portlet container similar to a servlet container
  • Both of these components generate content, which can be static or dynamic
  • Both portlets and servlets have a lifecycle that is controlled by the container
  • The client/server model is used for both servlets and portlets
  • The packaging and deployment are essentially the same
  • The manner in which the classes are loaded and the class loaders that perform the work are also the same
  • Lifecycle management is similar
  • The Request and Response semantics are also similar Here are some differences:
  • Servlets can provide complete web pages, whereas portlets only provide fragments. These fragments are then aggregated to form a complete web page by the portal
  • Portlets aren?t allowed to generated HTML code that contains tags such as base, body, frame, frameset, head, html, or title. The iframe tag can be used with caution.
  • The user cannot access a portlet directly using a URL in the way that a servlet is accessed. Instead, the URL points to the page containing all of the portlets on one page
  • Communication between the web client and the portlets is performed through the portal
  • Portlets can be provided with buttons or controls to manipulate the portlets? window states or portlet modes
  • Multiple instances of a single portlet can be placed onto the same page
  • Portlets support persistent configuration and customization
  • Portlets also support user profile information
  • Portlets support two scopes within the session; application scope and portlet scope
  • There are several things that servlets are allowed to do, but portlets aren?t. These include the following:
  • Portlet aren?t allowed to set the character set encoding of the response
  • Portlet also aren?t allowed to set the HTTP headers on the response
  • Portlet cannot manipulate the URL of the client request to the portal

5.What is a portlet container ?

A portlet container runs portlets and provides them with the required runtime environment. A portlet container contains portlets and manages their lifecycle. It also provides persistent storage for portlet preferences. A portlet container receives requests from the portal to execute requests on the portlets hosted by it.A portlet container is not responsible for aggregating the content produced by the portlets. It is the responsibility of the portal to handle the aggregation

6.Can I get the HttpServletRequest from a Portlet?

The PortletRequest object is supposed to give you everything you need i.e. parameters, attributes, dispatching, etc. As per the spec, you should not need the HttpServletRequest.
However, some portlet container implementations do provide some kind of hack to get hold ofHttpServletRequest e.g. in Pluto you can cast the RenderRequest to HttpServletRequest. But, be aware that this behavior cannot be relied upon.

7.What's difference between PortletConfig.getInitParameter() andPortletContext.getInitParameter()?

Context-wide init-params share the same context space as Servlets and JSPs belonging to the same application and they are defined in the web.xml file. You can get them usingPortletContext.getInitParameter() method.
Portlet-wide initialization parameters on the other hand belong in the portlet.xml file and you can get them using PortletConfig.getInitParameter() method.

8.What is a PortalSession Interface ?

User identification across many requests and transient information storage about the user is processed by PortletSession interace. One PortletSession is created per portlet application per client.
The PortletSession interface provides a way to identify a user across more than one request and to store transient information about that user.
The storing of information is defined in two scopes- APPLICATION_SCOPE and PORTLET_SCOPE. APPLICATION_SCOPE: All the objects in the session are available to all portlets,servlets, JSPs of the same portlet application, by using APPLICATION_SCOPE.
PORTLET_SCOPE: All the objects in the session are available to the portlet during the requests for the same portlet window. The attributes persisted in the PORTLET_SCOPE are not protected from other web components.

9.What is a PortletContext Interface ?

The portlet view of the portlet container is defined by PortletContext. It allows the availability of resources to the portlet. Using this context, the portlet log can be accessed and URL references to resources can be obtained. There is always only one context per portlet application per JVM.

10.Is there any difference betweeb websphere and weblogic ?

Webpshere tends to focus more on integration, connectivity and web services. it has rich implementation of J2EE, better performance, more extensive integration and transaction management. In terms of trnsaction weblogic is having default transaction attribute as ’supports’, but websphere does not have any default transaction attribute.

11.How to implement JDBC-ODBC bridge driver (Type 1 ) in Websphere?

If you use JDBC type (I) driver you dont need to add any driver in websphere. you simply created DSN and use it locally, same we use java class, if you use Type(2) and Type(4) so first go to admin console then go to connection, then add driver there fill other info like conn. size, uname pass, max conn. and connect it to you applications.

12.What is the difference between application server and web server?

ApplicationServer: takes care of Security, Transaction, Multithreading, Resource pooling, load balancing, clustering, performence, highly availability, scalability, etc. Exposes business logic to client applications through various protocols, possibly including HTTP. Supports deployment of .war and .ear filesApplication server = webserver + EJB container.
Webserver: handles HTTP protocol. Receives HTTP request, it responds with an HTTP response.

13.Explain relationship betweeb the Servlet Container and Portlet Container?

The portlet container is an extension of the servlet container. As such, a portlet container can be built on top of an existing servlet container or it may implement all the functionality of a servlet container. Regardless of how a portlet container is implemented, its runtime environment is assumed to support Servlet Specification 2.3

14.Explain portlet lifecycle?

A portlet is managed through a well defined life cycle that defines how it is loaded, instantiated and initialized, how it handles requests from clients, and how it is taken out of service. This life cycle of a portlet is expressed through the init, processAction, render and destroy methods of the Portlet interface.
Liferay is one of the most popular JSR compliant open source portal. This can be used to drive multiple websites with variety of features and look and feel. Liferay is developed in Java and the major portlet development on it is also supported by Java and few other languages.
The latest releases of liferay has been really feature rich and seen a increasing demand in liferay developers in recent past. Managing multiple websites using single liferay server installation is one of the main reason of liferay gaining popularity.
Liferay jobs are really high paying jobs due to being specialized in portlet segment of java web application development. There are many other portals available with free and paid options. To be highly valuable developer you must focus your knowledge to the JSR way of portlet development, this will ensure you can do development on any other JSR comliant portal as well.
Another positive aspect of Liferay portlet development is "The Liferay marketplace", this can give you an opportunity to develop and sell your own portlet to big businesses and grow your own business.
I have worked on liferay for more than 5 years and found that following interview questions are must know before getting a decent liferay developer job.

15.What is a Liferay Portal?

In general, a web portal represents a web application that provides a single point of access to variety of information.
Functionality of a portal can extended very easily by creating custom applications that can run inside a portal. These applications are called portlets.
For running portlets you need 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 third party like LDAP, Solr, SSO(CAS, Siteminder).
  • Portlets realted 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.
  • Suppport of hot deployment feature.

16.What is a Portlet?

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 catalogues as portlets produce fragments of markup code that are aggregated into a portal. So a portal page is displayed as a collection of portlet, thease 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.
Portlet is a small application to fulfill the requirement of certain domain. Inter portlet communication is supported under Liferay portal. Portlet support hot deployment feature of Liferay Portal.

17.What is the difference between Hook, EXT and Portlet?

Liferay provides 3 ways to extend the functionality of a Liferay portal. Each of the way fits is good for different needs.
Liferay portal comes with a bundle where all the default built in portlets exist. Typically if any customization required in terms of JSP (UI) and portal properties. We need to go by Hook implementation. Hook is supported by hot deployment. Liferay documentation suggests that - Whenever possible, hooks should be used in place of Ext plugins, as they are hot-deployable and more forward compatible.
Some common scenarios that require the use of a hook are

  • When you have to perform a custom action on portal startup
  • When you have to perform a custom action on user login
  • When you need to overwrite or extend portal JSPs
  • When you need to modify portal properties
  • When you need to replace a portal service with your own implementation.
  • EXT
    Liferay EXT Plugins are the most powerful way to extend the portal functionality. If any customization required in the core level classes then it can be done through EXT for example LDAP users and user groups import modification. but here in EXT, restart would be required.
    EXT Plugins should be used only in case the portal functionality can not be extended using Portlet of Hooks. The EXT plugins are complex to develop and may cause maintenance issues in case you are trying to upgrade.
    From liferay documents, The main use cases in which an Ext plugin may be used are:
  • Customizations to (that is not supported by Hook Plugins)
  • Customizing and making changes to the Struts Actions for portal
  • Customizations of the Liferay beans declared in Liferay's Spring files
  • Adding JSPs that are referenced from portal properties that can only be changed from an ext plugin (be sure to check if the property can be modified from a hook plugin before doing this)
  • Direct overwriting of a class (not recommended unless it's strictly necessary)
Portlets are the most common and easiest way to extend and provide a custom functionality for a liferay portal. This is a small application to fulfill the requirement of certain domain. It is basically a bunch of code(Java Files, JSP, CSS, Java Scripts etc.). Portlet is supported by hot deployment.
Liferay also has a marketplace where a lot of useful portlets are available for download and these portlets can contributed by anyone in the world. We recently contributed a Speed reading portlet and a My IP Address portlet in this marketplace for free use by liferay community.

18.What JSR version Liferay implements? Why JSR compatibility is important while choosing a portal?

JSR is a "Java Specification Request". Liferay Portal is developed to adhere to JSR 168 and JSR 286 specifications.
This specification is created by committee of JEE portal vendors. This specification is designed to achieve interoperability between different portals and portlets.
Liferay supports mainly below JSRs.
JSR-168(Portlet 1.0)
JSR-286(Portlet 2.0)
JSR-127(JSF 1.0)
JSR-314(JSF 2.0)

19.Why these standards are defined?

These standards are defined for the benefit of portal users (end customers). Before these standards were born, portal customer were required to use one portal and there was no easy way to switch between different portal vendors. Earlier portal were very vendor specific and all functionality were developed using proprietary API, technology and programming techniques. The JSR 168 and JSR 286 standards have defined the way portlets can be developed that will help users in long run.
Benefits of Following JSR Standards
Following these standards will ensure that there is no vendor lock in. However this can be guaranteed only when the portlets are developed sticking to the standards.

20.What is a Portlet Lifecycle?

Following is the portlet lifecycle:

  • init():It mainly initializes the portlet.
  • render(): It takes the HTML output to User Interface. It mainly render the view in term of JSP/HTML code and show into the respective portlet.
  • Destroy: This method takes care of releasing the portlet resources.

« Previous | 0 | 1 | 2 | 3 | 4 | Next »

copyright © 2014 - all rights riserved by