jsf - Handling service layer exception in Java EE frontend method -
i maintain web application have page jsf tag <f:event . have rewrote method in service class throw business exception. however, when business exception thrown, isn't caught in managed bean , exception showed on page. seems code try/catch doesn't work. in xhtml: <f:event listener="#{resourcebean.init(enrollment)}" type="prerenderview" /> listener method in managed bean: private boolean cancreateresource; public void init(enrollment enrollment) { (...) try { cancreateresource = resourceservice.cancreateresource(enrollment); } catch (businessexception e) { cancreateresource = false; } } method in service class: public boolean cancreateresource(enrollment enrollment) { if (...) { if (mandateservice.iscoordinator(user, course)) { return true; } else { throw new businessexception("undefined business rule."); } } return false; } from ...