Tuesday, January 3, 2012

A story of "Portlet" and "Servlet"

A story of "Portlet" and "Servlet"

There are so many things which are very clear and understood but if someone ask, it become difficult to explain them in deep. The topic I am going to write today, is something like that. Hope, you'll enjoy reading it, as I am going to write this time full on text, no practical implementation.


The contents of servlets provide generally takes up the whole page in a browser (if you are not framing them), and portlets content are wrapped in a window and we can place multiple portlets on same page with one another and each can provide different content and functionality. A portlet behaves like a full fledged application. The portal can provide some house keeping functionality and secured single point of entries to all of the portlets on a page.


lets see first some differences among portlets and servlets
  1. Servlets can provide complete web pages, whereas portlets only provide fragments. These fragments are then aggregated to form a complete web page by the portal.
  2. Portlets aren't allowed to generated HTML code that contains tags such as base, body, frame, frameset, head, html, or title. The iframe tag can be used with caution.
  3. The user cannot access a portlet directly using a URL in the way that a servlet is accessed. Instead, the URL points to the page containing all of the portlets on one page.
  4. Communication between the web client and the portlets is performed through the portal.
  5. Portlets can be provided with buttons or controls to manipulate the portlet's window states or portlet modes. 
  6. Multiple instances of a single portlet can be placed onto the same page.
  7. Portlets support persistent configuration and customization.
  8. Portlets also support user profile information.
  9. Portlets support two scopes within the session; application scope and portlet scope .
Here are some similarities:
  1. Servlets and portlets are web based components that utilize Java for their implementation.
  2. Portlets are managed by a portlet container similar to a servlet container.
  3. Both of these components generate content, which can be static or dynamic.
  4. Both portlets and servlets have a lifecycle that is controlled by the container.
  5. The client/server model is used for both servlets and portlets.
  6. The packaging and deployment are essentially the same.
  7. The manner in which the classes are loaded and the class loaders that perform the work are also the same.
  8. Lifecycle management is similar.
  9. The Request and Response semantics are also similar.
Advantage of Servlets over portlets-
  1. Portlet aren't allowed to set the character set encoding of the response.
  2. Portlet also aren't allowed to set the HTTP headers on the response.
  3. Portlet cannot manipulate the URL of the client request to the portal.

2 comments:

  1. Fantastic information. Thanks regarding offering people such a helpful information
    inventory management software dubai | check writing software

    ReplyDelete
  2. Thanks for the post, I am techno savvy. I believe you hit the nail right on the head. I am highly impressed with your blog.
    It is very nicely explained. Your article adds best knowledge to our Java Online Training from India.
    or learn thru Java Online Training from India Students.

    ReplyDelete