Total Pageviews

Sunday, October 14, 2012

Overriding Events: Working with PreActions and PostActions in Liferay using EXT

Liferay provides us facility to execute some code before and after of some specific events, namely Login, Logout and Service. Login and Logout are self-explanatory, Service is the event that takes place before or after every Action. For instance, If we have CustomServicePreAction and CustomLOginPreAction, in that case CustomServicePreAction will be called first then CustomLOginPreAction and then the LoginAction class will be invoked.
To achieve this, we need to make some entry in the, however some values are already present in file, we have to update those properties, as following:
Here the our custom classes are: 

  5., and 

Now we have to add the following classes in Ext:

1. CustomServicePreAction

2. CustomServicePostAction

3. CustomLoginPreAction

4. CustomLoginPostAction

5. CustomLogoutPreAction

6. CustomLogoutPostAction

And now, run your code. It will work.


  1. Hi
    we can implement CustomLoginPreAction,CustomLoginPostAction,CustomLogoutPostAction and CustomLogoutPreAction using why we need to go for EXT.correct me if i'm wrong

    1. Yes you are correct, but this article especially deals with EXT approach. I'm in-progress of writing an article with hooks approach too. thanks for asking.

  2. Thanks for your blog it's really helpful, I have one doubt that what is the exact difference in post and pre login and logout event. I have some confusion, if we check for a user is login or not then any of then can be used, may be possibility some seconds of difference. Then why these two. Thanks