JSF difference between action, actionlistener, onClick
jsf, jsf-2, primefaces
Solution
`onclick` will be executed first. It is used to call a javascript function.
`actionListener` is used when you want to have some ajax call to a method. That method should have the return type `void`, the method either take an `ActionEvent` as argument or no argument; it can also be used for a non-ajax call but then the page will be refreshed.
`action` is used to navigate to a different page; the method should have the return type `String`.
Problem
I am using JSF in my project. I am using a context menu from PrimeFaces. I see in `p:menuItem` we have `action`, `actionListener`, `onclick` methods. So my question is: When do I have to use `action`, `actionListner`, `onclick` and what is the order of execution?