Portlets Vs Servlets
================
Some of the basic similarities are:
Both are
Java technology based web
components
1 Life-cycle is managed by a specialized
container
– Servlet by servlet container
– Portlet by portlet container
2 Both generate dynamic content
3 Both interact with web client via a
request/response paradigm
Differences:
===========
Portlets only generate markup fragments, not
complete documents
? Portlets are not directly bound to a URL
? Web clients interact with portlets through a portal
system
? Portlets have a more refined request handling
– action requests and render requests
? Portlets have predefined states
– portlet modes and window states
? Portlets can exist many times in a portal page
Extra Features of Portlets
====================
? Portlets have means for accessing and storing
persistent configuration and customization data
? Portlets have access to user profile information
? Portlets have URL rewriting functions for creating
hyperlinks within their content
– allow portal server agnostic creation of links and
actions in page fragments
? Portlets can store transient data in the portlet
session in two different scopes
– application-wide scope
– the portlet private scope
Servlet Features Forbidden to Portlets
=========================
? Setting the character set encoding of the
response
? Setting HTTP headers on the response
? The URL of the client request to the portal
Servlet Features that areleveraged by Portlets
=================================
? Portlets can leverage servlets, JSPs and
JSP
tag-libraries for generating content
– Content should be markup fragment
? A portlet can call servlets and JSPs using a
request dispatcher
Integration between the two
===================
? Attributes set in the portlet request are
available in the included servlet request
? Attributes set in the portlet session are
accessible from the servlet session and vice
versa
? Portlet and the included servlet or JSP
share the same output stream
Hope the above helps
-Sethu Rengarajan