Monday, July 30, 2012

How can you get PortletContext Object?



1. we can call GenericPortlet's useful method : getPortletContext()



The PortletContext object can also be obtained using the PortletSession or PortletConfig objects

2. We can get PortletContext from PortletConfig object

  PortletContext getPortletContext()
          Returns the PortletContext of the portlet application the portlet is in.


3. We can get from PortletSession

   PortletContext getPortletContext()
          Returns the portlet application context associated with this session.




Please note that GenericPortlet has method to provide PortletConfig and PortletContext

 PortletConfig getPortletConfig()
          Returns the PortletConfig object of this portlet.
 PortletContext getPortletContext()
          Returns the PortletContext of the portlet application the portlet is in.

No comments:

Post a Comment