There are several ways to change the functionality of your own Liferay portlet. Here is a quick overview.
Most binding functions are described through the liferay-hook.xml file located in the / docroot / WEB -INF directory. Here is the most common method.
In liferay-hook.xml, add the following child to <hook/>
<custom-jsp-dir>/META-INF/custom_jsps</custom-jsp-dir>
This element defines the location of the JSP overwriting location. For example, you can rewrite view.jsp for a document library portlet at:
[custom-jsp-dir]/html/portlet/document_library/view.jsp
To do this, you will need to define the portal.property file, which is usually stored in
/docroot/WEB-INF/src/portal.property
And tell liferay-hook.xml its location. Below is an example of the above,
<portal-properties>portal.properties</portal-properties>
if you want to listen to changes in User, for example, you should write in the property
value.object.listener.com.liferay.portal.model.User=com.my.example.UserListener;
What is in the following format,
value.object.listener.[class-to-listen]=[my-listener-class]
And your class should implement com.liferay.portal.model.BaseModelListener .
Here you can listen to events such as Add, Update, Delete, and several others.
A similar story is here in liferay-hook.xml in the <hook /> add element
<service> <service-type>com.liferay.portal.service.UserService</service-type> <service-impl>my.example.service.UserServiceImpl</service-impl> </service>
Here, your implementation should extend the correct wrapper class for a particular service. For example, for the example above,
com.liferay.portal.service.UserServiceWrapper;
Now you can overwrite all public UserService methods, for example updateUser(..) .
(available for Liferay 6.1 only)
Similarly, as extension services, define elements for <hook />
<struts-action> <struts-action-path>/message_boards/view</struts-action-path> <struts-action-impl>my.example.action.SampleViewAction</struts-action-impl> </struts-action>
You need to expand
com.liferay.portal.kernel.struts.BaseStrutsAction
and you will get access to the request and be able to perform a custom action. It is very powerful when combined with custom JSPs.
Good luck
Be sure to check compatibility with the version of Liferay that you are using.
If you need even more control, you will need to use an ext-plugin.