Saturday, October 30, 2004

Framework for Portlets

Portlets, like model-I JSPs, need some framework to keep code manageable. While saying framework, initially we are more concerned with the basic structure of the portlets. Though it can be argued that portlets are based on MVC pattern and less prone to code management problems. But due to single controller architecture, soon the controller codes start zooming and becomes highly unmanageable. At this stage we need some framework with some best practices to avoid code management problems. There are various methodologies available like State Pattern by IBM. Here in this article authors has suggested that portlets have three major functions -

1. Validate
2. Store Data
3. Prepare Request

Based on above assumption, he has tried to standardize above three major processes of portlet development. Idea is new one and, in my opinion, can be useful for small to medium size portlet development. For detailed portlets (say more than 100 lines of code), in my opinion, we should go for some proper framework like JSF, Spring or Struts. Have a look at the article - Portlet How-To: Using an Action Interface to Improve Portlet Code.


  1. Spring Sandbox has some initial support for PortletMVC, basically a port of the SpringMVC stuff to fit inside a portlet container. At Rutgers, we've started using the initial support in some projects with some success.

  2. This comment has been removed by a blog administrator.

  3. Hi Punit

    As you said we should go for either struts or spring kind of frame. Could you please let us know how could we use Struts2 app as a portlet.

    Thank you
    vishnu.j2eedeveloper at gmail dot com

  4. Hi Punit

    As you mentioned in your blog when we go for big portal apps we need to go for some MVC framework like struts, spring etc., Could you please let us know how to us struts 2 app as a portlet.