Featured post

Docker setup for Liferay 7 with MySQL

Monday, 21 May 2012

Create Hook Inside a Portlet, Liferay

Hi Folks,

Yesterday i tried something new, it's easy but useful.

Sometimes we have a requirement where we need a portlet which depends on some extended functionality of Liferay. So in that case we have to create a external hook and provide two wars separately.

Their is an answer, we can create a Portlet which also contains a Hook.


Steps to Go -
1) Create a simple portlet.
2) Put a liferay-hook.xml in WEB-Inf in your portlet.
3) Map the entry, which functionality you want to extend, e.g. portal.properties,stratup-events.
4) Put the require file in place as you put in Hook.

Example : Create a Portlet which extends an startup events by Hook.
1) Create a Hello Portlet.
2) Put liferay-hook.xml in WEB-Inf.
3) Put this entry in liferay-hook.xml file -


<hook>
<portal-properties>portal.properties</portal-properties>
</hook>

4) Create portal.properties in src of Hello portlet.
5) Copy below line to portal.properties -

application.startup.events=com.gomedia.startup.events.StartupAction

6) StartupAction is the class which extends SimpleAction and executes strartup events.

You are just done, Try & Enjoy the function.............:))


2 comments:

  1. Thanks..it helped me

    ReplyDelete
  2. What abt com.gomedia.startup.events.StartupAction?

    ReplyDelete

Gadget

This content isn't available over encrypted connections yet.