Portlets are pluggable user interface components that are managed and displayed in a web portal.If you are aware of servlets, then you should know similarities between Servlet and Portlet
.
Similarities between servlets and portlets
- Both servlets and portlets use the web.xml as deployment descriptor.However,Portlets have an additional deployment descriptor portlet.xml to define the portlets.
- Portlets have Context interface which allows developer to access the Portlet application under which portlet is running.This is similar to Servlet’s context interface.
- Portlets have their own config object,PortletConfig, Which can be used to access the properties with in portlet.xml.This is also like ServletConfig.
- Listeners and Wrappers used by the portlets are still declared in a web.xml for both.
- Both Lifecycle’s managed by containers only(PortletContainer,ServletContainer)
- Both produces the dynamic content.
- Both interact with Web client via request,response paradigm.
- Instead of HttpServletRequest and HttpServletResponse object,Portlet expect ActionRequest or RenderRequest object and ActionResponse or RenderResponse.
Different from Servlets
- Portlets generate markup fragments,not complete documents.
- Portlets are not directly URL accessible.We can access the portal URL containing the portlet.
- Portlet can’t generate arbitrary content,since the content generated by portlet is going to be part of Portal page.If server asking for html/text then all portlets should generate html/text content.If it asks WML then all should generate WML.
No comments:
Post a Comment