Frage

I need to intercept valueChange event on h:SelectOneMenu element, but it does not work. What I could miss?

I tried both this:

<h:selectOneMenu value="#{MainPage.<value_name>}"
                         valueChangeListener="#{MainPage.<method_name>}">
...
</h:selectOneMenu>

and this:

<h:selectOneMenu value="#{MainPage.<value_name>}">
...
    <f:ajax render="@form" event="change" listener="#{MainPage.<method_name>}"/>
</h:selectOneMenu>

these do not want to work.
Here is my method:

public void <method_name>(ValueChangeEvent e){
    ...
    System.out.println(">>>Changed<<<");
}

as a result, nothing happened, and there are no any errors in logs.
I'm using NetBeans 7.3 with jboss AS 7.1.

War es hilfreich?

Lösung 2

<h:message/> tag helped me to deal with my problem. The problem was in types and in lack of custom converters.

Andere Tipps

For the first way, try to add the essential attribute :

<h:selectOneMenu onchange="submit()" ... >

For the second way, the class of the paramter event in the method should be : AjaxBehaviorEvent.

Also, make sure your controller-bean is @ViewScoped.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top