Hi, i want to know if it is possible to call JSF events, such as a valueChangeListener and actionListener from an Inner bean, that is, a bean that is an objetc inside some other Managed Bean?
Thanks.
Hi, i want to know if it is possible to call JSF events, such as a valueChangeListener and actionListener from an Inner bean, that is, a bean that is an objetc inside some other Managed Bean?
Thanks.
Yes, you can. You only need to make sure that the instance is available during the actual request.
E.g.
<h:inputText valueChangeListener="#{bean.nested.change}" />
in combination with
public class Bean {
private Nested nested; // +getter
}
and
public class Nested {
public void change(ValueChangeEvent event) {
// ...
}
}
is not going to work if Nested
is not been instantiated in Bean
. The #{bean.nested}
would then return null and the method is unreachable. Thus, ensure that it is been instantiated:
public class Bean {
private Nested nested = new Nested(); // +getter
}
EL namely won't do that for you.