public String doButton1Action() { try { String ssn = (String)getSessionScope().get("SSN"); System.out.println("Logon " + ssn); CustomerManager customerManager = (CustomerManager)getManagedBean("customerManager"); Customer customer = customerManager.findCustomerBySsn(ssn); if (customer == null) throw new Exception("Customer not found"); return "login"; } catch (Exception e) { System.out.println("Login exception: " + e.getMessage()); getFacesContext().addMessage("ssn1", new FacesMessage("Customer record not found.") ); return "failed"; } }