Table of Contents
This guide covers the Liferay specific deployment description and explains the tools, additional features and services that Liferay Portal offers to developers of portlets. A portlet is a web application that follows a set of conventions that allow portals to manage its lifecycle and integrate them with other portlets.
The following sections provide an introduction to the development of portlets and the environment recommended for this task.
Developing a Java Portlet is similar to the process of developing a Servlet based web applications. The main differences are:
The portlet only produces a fragment of the final HTML and not the full markup. The portal will join the fragments of several portlets and will create the full page returned to the user.
The class receiving the requests has to inherit from javax.portlet.Portlet instead of javax.servlet.http.HttpServlet.
A portlet request may involve a two phase process:
On each request at most one portlet will be able to
perform an state-changing operation. This is referred to as the
Action phase and is implemented through a method called
processAction
. Not always an action phase is
needed. Requests that involved an action phase are invoked to an
URL known as an ActionURL, while those that only have a render
phase are invoked through a RenderURL.
Next is the render phase where all other portlets related
to the page that is going to be returned may be called in any
order to produce the HTML fragment to draw themselves. Portlet
implement this functionality through a method called
render
.
Existing web application development frameworks such as Struts, JSF, Webworks, etc can be used through the use of Bridges. Other existing frameworks have been adapted to be usable directly without the need of a bridge. An example is the Spring Portlet MVC framework.
A portlet container is a server side software component that is capable of running portlets. A portal is a web application that includes a portlet container and may offer additional services to the user. Liferay Portal includes its own portlet container and offers lots of functionalities such as user and organization administration, creation of virtual communities, having pages based on portlet layouts, graphical selection of portlets and drag&drop to place them, grouping pages into websites, several bundled ready-to-use portlets, and much more.