I have a JSF 2.0 app that has a session bean that is accessed from home.xhtml, as follows:
@Named(value = "home")
@SessionScoped
public class Home implements Serializable{
@PostConstruct
public void init() {
// Retrieve database data here
try {
} catch (Exception ex) {
System.out.println("EXCEPTION");
}
}
}
What I want to do is, if the database retrieval fails, redirect to error.xhtml page. How is this done in the init method above?