Basics of Portlets

        
          Portlet Life Cycle
  1. Initialization Phase :  init()                                                                                                       The portlet container intstantiate and initialize the portlet application.It call the init() method      for initial portlet configuration.
      2.  Action Phase         :  processAction() 
           When user request for a portlet action by hitting the ActionURL the processAction()
           method is called by the portlet container

      3.  Render Phase         :  render()
           Render phase is called automatically after the action phase is executed. if action phase of
           one portlet in a page is executed then render phase of all the portlet in that page is
           executed

       4. End of service Phase : destroy()


         Portlet URL 

  • renderURL: this is the type of URL that we have used so far. It invokes a portlet using only its render phase.
  • actionURL: this type of URL tells the portlet that it should execute its action phase before rendering all the portlets in the page.
  • resourceURL: this type of URL can be used to retrieve images, XML, JSON or any other type of resource. It is often used to generate images or other media types dynamically. It is very useful also to make AJAX requests to the server. The key difference of this URL type in comparison to the other two is that the portlet has full control of the data that will be sent in response.                                                                                                                                             

    PortletContext, PorteltConfig  and PortletPreferences

    PortletContext :-  PortletContext scope is application level which is used to access the values declared in the web.xml. It is accessible by the PortletContext.getInitParameter() method. PortletConext is accessible to all the portlets in that portlet application.

    PortletConfig :- PortletConfig is same as that of ServletConfig which is used to access the
    parameter declared in the portlet.xml file. PortletConfig is specific to a particular portlet
    and are accessible to all the instances of that portlet .

    PortletConfig.getInitParameter(""); 

    PortletPreferences
    Portlet preferences are user specific. A PortletPreference keeps information about a specific user.



     

Comments

Popular posts from this blog

React development in Liferay - Overview

Deploy Liferay DXP on google cloud

Liferay React with Webpack