What is the best approach to execute a method in a bean before the JSF page using that bean is rendered?
Update: I am trying to execute a method which would populate some data used by the JSF backing bean. This backing bean is used in a form on a JSP page, where I need some prepopulated data.
In JSF2 you can use system Event also.
<f:event type="preRenderView" listener="#{customerBean.loadData}"/>
Constructor of bean / post construct @PostConstruct
methods will do it.
But the best approach is greatly depends on the functionality you are implementing ,
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