It's not a secret anymore!
The moose likes Portals and Portlets and the fly likes portlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "portlet" Watch "portlet" New topic


nirjari patel
Ranch Hand

Joined: Apr 23, 2009
Posts: 386
whats the difference between and servlet and portlet ?
Does portlet work on any diffrent principles or mechanism than servlet ?

Sethu Rengarajan

Joined: Aug 22, 2009
Posts: 1
Portlets Vs Servlets

Some of the basic similarities are:

Both are Java technology based web
1 Life-cycle is managed by a specialized
– Servlet by servlet container
– Portlet by portlet container
2 Both generate dynamic content
3 Both interact with web client via a
request/response paradigm


Portlets only generate markup fragments, not
complete documents
? Portlets are not directly bound to a URL
? Web clients interact with portlets through a portal
? 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
? 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
? Portlet and the included servlet or JSP
share the same output stream

Hope the above helps
-Sethu Rengarajan

I agree. Here's the link:
subject: portlet
It's not a secret anymore!