Search code examples
javaservletsjakarta-eeportlet

what is the difference between a portlet and a servlet?


I have been asked to work on portlets and portals, and I want to know the differences between a portlet and a servlet.

How and where does a portlet differ (maybe functionally) from a servlet?


Solution

  • Portlets are part of JSR-168 standard that regulates portal containers and components. This is different standard from standards for web containers (and servlets). Though there are definitely strong parallels between these two standards they differ in containers, APIs, life cycle, configuration, deployment, etc.

    The main difference between portlet vs. servlet could be that while servlet always responds to single type of action - request, portlet (due to nature of its life cycle and stronger container bindings) has to respond to two types of actions: render and request. There are of course more to it but I found this as the core difference between the two when I studied portal development.