public void login() throws IOException { try { current = userService.find(username, password); FacesContext.getCurrentInstance().getExternalContext().redirect("pages/read.jsf"); } catch (PostException e) { FacesContext.getCurrentInstance() .addMessage( null, new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), e.getMessage())); } }