How to use ajax and ActionListener in jsf
<p>i am using a jsf page and i am using a command link with Ajax that makes a call to a method called "addPoints()" on a bean called "answerManagedBean" and also i have an action listener. I want the action listener to intercept the call to the bean when the command link is clicked so i can check something before addpoint() method is called. but whats happening is the addpoint method is called before the action listener and after the method is executed the action listener is called. So ehy is this happing and how can solve it?
this is my code</p>

<pre><code>&lt;h:commandLink&gt;
    &lt;f:actionListener type="cs.edu.cs545.ActionListener.ClickActionListner"/&gt;
    &lt;f:ajax render="@form" listener="#{answerManagedBean.addPoint(o.id)}"/&gt; 
&lt;/h:commandLink&gt; 
</code></pre>