title: Getting the current global messages from FacesContext
body: <p>I have a problem. I need to know whether my page has global errors or not. This is because I have 2 different <code>h:messages</code> (error containers)  </p>
  
  <pre><code>&lt;h:messages id="errorMsgsContainer"
  layout="table" 
  rendered="true"
  styleClass="message-container error-message" 
  infoClass="info" 
  errorClass=" error" warnClass="warn-message warn" globalOnly="true"/&gt;
  
  &lt;h:messages id="errorMsgsContainerValidation"
  layout="table" 
  styleClass="message-container error-message-validation" 
  infoClass="info" 
  errorClass="error" globalOnly="false"/&gt;
  </code></pre>
  
  <p>One will show the business related messages and the other will just show the validation messages. There are two <code>messages</code> because of business requirements. </p>
  
  <p>When validation error messages are produced, the facelet works fine, because one of the <code>messages</code> tag has the <code>globalOnly="true"</code> attribute-value pair.</p>
  
  <p>The problem comes when I've a global-only error. It will appear in both boxes.</p>
  
  <p>I want to know if any of there errors are global, so I don't show the validation container till the global errors are fixed by the user on my form.</p>
  
  <p>I've tried to get it through the <code>FacesContext</code> with </p>
  
  <pre><code>FacesContext.getCurrentInstance().getMessageList().get(i).getSeverity()
  </code></pre>
  
  <p>and some other commands but it does not seem to work.</p>
  
  <p>Please help me to solve this problem. How can I get the current global messages list, so I can know if there is any global error?</p>