Pages

Wednesday, March 28, 2012

How to create liferay hook


Using hooks customizing jsp page of a existing liferay portlet. In this example I am taking portlet asset-publisher.

Step 1: Go to plugins/hooks create a folder with any name. eg asset-publisher-hook

Step 2: Go to asset-publisher-hook create folder docroot and build.xml file.

Content of build.xml should be like this:









Step 3:

Go to asset-publisher-hook/docroot create folder with name WEB-INF.

Step 4:

Now under WEB-INF create a file liferay-hook.xml and a folder with name jsps.

Step 5:

In liferay-hook.xml write following code.





/WEB-INF/jsps


Step 6:

Under jsps create folders html/portlet/portlet_name in our case portlet_name is asset-publisher.

Step 7:

Under portlet_name create the same structure for the page which we want to modify.

Eg. In asset-publisher we will try to modify full_content.jsp then structure will be

html/portlet/asset-publisher/display/full_content.jsp

Step 8:

Customize the jsp file.

Step 9:

Go to plugins/hook

Do ant deploy

Step 10:Check the changes on server

No comments:

Post a Comment