Until the upcoming EL 3.0, you cannot reference constants in EL.
Regarding open source libraries, the only thing that can help you is OmniFaces . It offers a <o:importConstants> tag for the purpose itself.
<o:importConstants type="javax.faces.application.FacesMessage" />
This way you can use
#{facesContext.maximumSeverity eq FacesMessage.SEVERITY_ERROR or facesContext.maximumSeverity eq FacesMessage.SEVERITY_FATAL}
or
#{facesContext.maximumSeverity.compareTo(FacesMessage.SEVERITY_WARN) gt 0}
or
#{facesContext.maximumSeverity.compareTo(FacesMessage.SEVERITY_ERROR) ge 0}
or
#{facesContext.maximumSeverity.ordinal gt FacesMessage.SEVERITY_WARN.ordinal}
or
#{facesContext.maximumSeverity.ordinal ge FacesMessage.SEVERITY_ERROR.ordinal}
(note that I skipped the unnecessary get and () parens prefix, IDE autocomplete in EL does not necessarily generate correct and clean code)
source share