Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Replace or override function on a Liferay native portlet

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 539
    Comment on it

    Liferay have several ways to modify the functionality of a native Liferay portlet and you can extend the functionality.

    Liferay provide most hooked functionality is described by using the liferay-hook.xml file located in /docroot/WEB-INF directory.

    Here are the most common methods are shown :

    Custom JSPs

    Add the following child to in liferay-hook.xml file.


    Above element defines the location of custom jsp page's.
    For example you may want to rewrite view.jsp for the Document Library portlet at:


    Model Listeners

    Model Listeners, In which you will have to define a file located at,


    The following is an example for the above :


    If you want to listen to changes in User, for example, you would write in the property.;

    As following format :


    Your class should implement com.liferay.portal.model.BaseModelListener.

    Here, You can listen to events such as Add, Update, Remove etc.

    Extend\Overwrite Service

    A similar here, in liferay-hook.xml in the element add


    Your implementation should extend the correct wrapper class for a particular service.
    For the example above shown below:


    You should now be able to overwrite or extend all the public methods for the UserService like updateUser(..).

    Customization of Struts Actions

    In very similar as extending services, define the elements for


    You should need to extend BaseStrutsAction class.


 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: