user3748888
user3748888

Reputation: 9

h:commandLink with f:ajax doesn't work

i use jsf2.0. my code look like this:

<h:form id="form">
    <h:commandButton  value="testbutton" action="#{Bean.test}">
        <f:ajax   render="msg"/>
    </h:commandButton>
    <h:outputText value="#{Bean.outmsg}" id="msg"/>
</h:form>

it's working well. but if i change h:commandbutton to h:commandlink, code look like this:

<h:form id="form">
    <h:commandLink  value="testbutton" action="#{Bean.test}">
        <f:ajax   render="msg"/>
    </h:commandLink>
    <h:outputText value="#{Bean.outmsg}" id="msg"/>
</h:form>

then my code can't work. i need help,thanks guys.

Upvotes: 0

Views: 2188

Answers (1)

softpower
softpower

Reputation: 135

use this code.

<f:ajax event="click" render="msg" listener="#{Bean.test}"/>

should be your java bean side like this.

public void test(AjaxBehaviorEvent event) {   }

Upvotes: 3

Related Questions