I have to call backend code as soon as one value is selected from drop-down list. I am using JSF 2.0. In JSF 1.2 I did it by using <a4j:support>
in <h:selectOneMenu>
, but I am not geting how to do it in JSF 2.0.
Use the <f:ajax>
tag. It's much similar to the <a4j:support>
.
<h:selectOneMenu value="#{bean.selectedItem}">
<f:selectItems value="#{bean.selectItems}" />
<f:ajax listener="#{bean.valueChanged}" />
</h:selectOneMenu>
with
public void valueChanged() {
// ...
}
The <f:ajax>
has also an event
attribute which already defaults to valueChange
when used in <h:selectOneMenu>
, so it is been omitted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With