Wednesday, July 04, 2012

Liferay JSP Hook

Liferay JSP Hook Creation
 -------------------------------------------------------------------------------------
To view it require latest version of firefox and adobe flash player. -------------------------------------------------------------------------------------




LIFERAY HOOKS-Advance-I

Hook to override jsp files :

This is most simple hook.
Task: We are going to modify Terms of use page when user gets Login first time.
Steps
Create directory inside our hook : liferay-plugins-sdk-6.1\hooks\myfirsthook-hook\docroot\META-INF\custom_jsps

Modify liferay-hook.xml file.

<hook>
<custom-jsp-dir>
/META-INF/custom_jsps
</custom-jsp-dir>
</hook>

terms_of_use.jsp file is present within tomcat\webapps\root\html\portal.




Create Similar mirror folder structure within /META-INF/custom_jsps in our hook..
Create hooks\myfirsthook-hook\docroot\META-INF\custom_jsps\html\portal folder.
Now copy tomcat\webapps\root\html\portal\terms_of_use.jsp and put it into \myfirsthook-hook\docroot\META-INF\custom_jsps\html\portal in hook folder.
Edit the terms_of_use.jsp as u like.
Now deploy hook.
Create new user and login to liferay, modified tems_of_use.jsp will get displayed.



After deployment of hook old jsp will get rename to terms_of_use.portal and new one get placed at their place.




Note: Don’t use different hook to override same jsp as liferay will not recognizes which one to use.
---------------------------------------------------------------------------------------------------

Hook to Override JSP


Hooks to Override Portal Properties File


Hooks to override language Properties Files


Hooks to override user Login and Landing Page-PerLogin and Postlogin


Hooks To override Struts Actions


Hooks to override dockbar Portlet



--------------------------------------------------------------------------------------------------- 

1 comment:

Unknown said...

hey nice source for us,thanks for sharing the informative ideas of the jsp hook creation in liferay and i bookmark this blog for the future purpose.

Liferay Development

Junit 5 Architecture

Modules in JUnit 5 : •         junit-jupiter-api: This module defines the API that you need to write your tests. •         ...