Im working on a JSF2
and richFaces4
application and I want to execute a backing bean action on load of one of my xhtml
view.
Thanks.
If you make a bean @ViewScoped
, a method with a @PostConstruct
annotation will be invoked exactly once when rendering an xhtml view that references it.
For example:
@ManagedBean
@ViewScoped
public class Foo {
@PostConstruct
public void onPageLoad() {
...
}
}
<h:outputText value=#{foo.property}"/>