FacesContext context = FacesContext.getCurrentInstance(); Iteratormessages = context.getMessages(); while(messages.hasNext()) { System.out.println(messages.next().getSummary()); }
FacesContext context = FacesContext.getCurrentInstance(); IteratorBoth examples use the javax.faces.context package library which is included in the JavaServer Faces framework.messages = context.getMessages(null); while(messages.hasNext()) { FacesMessage message = messages.next(); if (message.getSeverity() == FacesMessage.SEVERITY_ERROR) { context.addMessage("errorMessage", message); } }