0

i'm studting jsf, i have some problem using <p:commandButton> and <f:actionListener>.

I was testing my understanding of this question

so in a jsf page i wrote:

<p:commandLink  value="Test"
                onstart="alert(#{testBean.sayHello})"
                update="@this" //this should be redundant
                oncomplete="alert(#{testBean.sayHello})">
    <f:actionListener binding="#{testBean.setString()}" />
</p:commandLink>

the TestBean

@Named
public class TestBean {
    private String sayHello;

    public String getSayHello() {
        return sayHello;
    }

    public void setSayHello(String sayHello) {
        this.sayHello = sayHello;
    }

    public void setString(){
        setSayHello("Hello my friend");
    }
}

the first alert show just an empty string, but the second too, why?

Community
  • 1
  • 1
Marco
  • 139
  • 4
  • 13

0 Answers0