Wednesday, July 4, 2012

write some differences between servlet and portlets?

Developing a Java Portlet is similar to the process of developing a Servlet based web applications. The main differences are:
  • The portlet only produces a fragment of the final HTML and not the full markup. The portal will join the fragments of several portlets and will create the full page returned to the user.
  • The class receiving the requests has to inherit from javax.portlet.Portlet instead of javax.servlet.http.HttpServlet.

  • A portlet request may involve a two phase process:
    1. On each request at most one portlet will be able to perform an state-changing operation. This is referred to as the Action phase and is implemented through a method called processAction. Not always an action phase is needed. Requests that involved an action phase are invoked to an URL known as an ActionURL, while those that only have a render phase are invoked through a RenderURL.
    2. Next is the render phase where all other portlets related to the page that is going to be returned may be called in any order to produce the HTML fragment to draw themselves. Portlet implement this functionality through a method called render.

No comments:

Post a Comment