How can be stopped automatic method call from @ManagedBean class at page refresh, JSF
<p>In my XHTML page I'm calling a method from my @ManagedBean class. The method should be executed only when I click the link which to is linked the method:</p>

<pre><code>  &lt;h:link value="Continue Reading &amp;raquo;" 
       outcome="contracts/resources/data/imag2_facebook.html"  
onclick="#{sessionFilter.incForLink2('contracts/resources/imagini/facebook.jpg','Facebook down? Current problems and status', 'contracts/resources/imagini/facebook.jpg')}" /&gt;
</code></pre>

<p>It's weird why the method is executed at every page refresh without clicking on the link. I want the method to execute only when I click on the link. I have also tried with h:commandLink but the results are the same. Do you have an idea what I need to change, or what is wrong? The @ManagedBean class is application scoped. The method I call is the following:</p>

<pre><code>public void incForLink2(String link, String title, String imgAllLink) {
    Article article = links.get(link);
    if (article != null) {
        Integer pageHits = article.getPageHits();
        article.setPageHits(pageHits + 1);
        System.out.println(link + " = " + pageHits);
    } else {
        Article article1 = new Article(1, title, link, imgAllLink);
        links.put(link, article1);
    }
}
</code></pre>