• Portlet Lifecycle In Liferay

    Portlet Lifecycle In Liferay

    In This Blog Lets see how a Portlet's Life cycle is managed by a portlet container from its initialization to destroy.portlet have similar lifecycle as that of a servlet, portlet needs a portlet container similar to a servlet, we know that  servlet have lifecycle of init(), service() and destroy() similarly liferay's lifecycle have the following stages.

    1. init()  
    This is the first method which will be triggered when we deploy the portlet in portlet container such as tomcat, jboss or any portlet container. This method will be called only during the deployment of the portlet.

    2. render()
    Once you deploy the portlet and add the portlet to your page render() method will be called, this method will process the configured jsp and returns the html content to the portlet.

    3. processAction()
    processAction method will be called when we use Action URL in our portlet, usually it is used for form submitting CRUD actions.

    4. processEvent()
    processEvent method is part of the JSR 286 portlet specification standards, this method is aimed to execute when an event is raised by another portlet via Inter Portlet Communication (IPC) mechanism.

    5. serveResource()
    serveResource method is also part of the JSR 286 portlet specification standards, it will be executed and used for AJAX request handling, we can call this method by creating a Liferay resource URL

    6. destroy()
    This is the last method which will be executed when the portlet is undeployed from the portlet container, when this method gets executed we can conclude that the portlet is removed from the portlet container


    Post a Comment