samedi 29 juillet 2017

JSF outputlabel click event

first of all, I am very new to JSF and web development.

What I want to do is to print a message in the console if the user click an outputlabel.

{businessBean.select()} gets called only on page refresh and not when I click.

<h:outputLabel styleClass="cat" id ="businesstasks" onclick="setColor('businesstasks'); #{businessBean.select()}">
                 Business and productivity                      
            </h:outputLabel>

My test bean:

@ManagedBean(name="businessBean")
@SessionScoped
public class businessBean {
    public void select(){
        System.out.print("Test");
    }
}

I get "Test" only when I refresh the page but I want to get it on every click.

Thanks for helping!




Aucun commentaire:

Enregistrer un commentaire