Reputation: 75
I am trying to execute the following code with JSF 2.0, i am trying to call a Managed Bean method for the value change of the "boolean check box", i am trying to use tag for it. But the managed bean method is not being called.
My JSF code is as follows:
*<h:panelGrid columns="3" styleClass="prepend-2 span-20">
<h:dataTable value="#{report.resultList}" var="list">
<h:column >
<h:selectBooleanCheckbox layout="pageDirection"
value="#{list.selected}">
<f:ajax event="change"
listener="#{report.getStaffIdList}" render="@form" immediate="true" execute="@this" />
</h:selectBooleanCheckbox>
</h:column>
<h:column>
<f:facet name="header">StaffID</f:facet>
<h:outputText value="#{list.staffID}"></h:outputText>
</h:column>
<h:column>
<f:facet name="header">Name</f:facet>
<h:outputText value="#{list.name}"></h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{report.searchQueryHeading}" />
</f:facet>
<h:outputText value="#{list.queryResult}"></h:outputText>
</h:column>
</h:dataTable>
</h:panelGrid>**
My Managed Bean:
public void getStaffIdList(AjaxBehaviorEvent ve){
System.out.println("inAjax");
}
Upvotes: 2
Views: 8127
Reputation: 1
To redraw the only component, use this method
<h:selectBooleanCheckbox value="#{bean.rewrite}" valueChangeListener="{#bean.valueChangeMethod}">
<a4j:ajax execute="@region" event="change" />
</h:selectBooleanCheckbox>
Upvotes: 0
Reputation: 338
you can also try the approach without ajax. Add the following code to your selectbooleancheckbox:
valueChangeListener="#{bean.listener}" onchange="submit()"
Upvotes: 1