@ManagedBean(name="bean")
@SessionScoped
public class MyBean{
@PostConstruct
public void postConstruct()
{
System.out.println("Inside post Construct");
}
public void beforePageLoad()
{
System.Out.println("Called before pageload for session scoped bean!!!");
}
}
How can we call beforePageLoad method everytime before the page loads.
答案 0 :(得分:2)
在你的页面内:
<f:metadata>
<f:event type="preRenderView" listener="#{bean.listener}"/>
</f:metadata>