Java Code Examples for javax.faces.context.FacesContext.getMessageList()

The following are Jave code examples for showing how to use getMessageList() of the javax.faces.context.FacesContext class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ctsms   File: Messages.java   View Source Code Vote up 5 votes
public static List<FacesMessage> getMessageList() {
	FacesContext context = FacesContext.getCurrentInstance();
	if (context != null) {
		return context.getMessageList();
	}
	return new ArrayList<FacesMessage>();
}
 
Example 2
Project: admin-template   File: CustomExceptionHandler.java   View Source Code Vote up 5 votes
/**
 * If there is any faces message queued add PrimeFaces validation failed
 *
 * @param context
 */
private void findErrorMessages(FacesContext context) {
    if (context.getMessageList().isEmpty() || context.isValidationFailed()) {
        return;
    }
    for (FacesMessage msg : context.getMessageList()) {
        if (msg.getSeverity().equals(FacesMessage.SEVERITY_ERROR) || msg.getSeverity().equals(FacesMessage.SEVERITY_FATAL)) {
            validationFailed();
            break;
        }
    }
}