Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic


nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
whats the difference between and servlet and portlet ?
Does portlet work on any diffrent principles or mechanism than servlet ?

Sethu Rengarajan
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic