title: Unhandled Faces messages on validation of required=true
body: <p>I have a very simple problem but for the life of me I can't see where I'm going wrong. I have started to create a 'reset password' page with email and password inputs and a commandButton. Both input fields are required, but if I leave for example the password empty and click the button no message is displayed, and the server reports a warning:</p>
  
  <blockquote>
    <p>WARNING: There are some unhandled FacesMessages, this means not every
    FacesMessage had a chance to be rendered. These unhandled
    FacesMessages are:
    - Please enter a new password</p>
  </blockquote>
  
  <p>This is my page:</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"&gt;
  
      &lt;h:head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;/meta&gt;
          &lt;link type="text/css" rel="stylesheet" href="/css/main.css" /&gt;
          &lt;title&gt;Request Password Reset&lt;/title&gt;
      &lt;/h:head&gt;
  
      &lt;h:body&gt;
          &lt;p:outputPanel layout="block" id="container"&gt;
  
              &lt;ui:include src="/header-branding-only.xhtml" /&gt;
  
              &lt;h3&gt;
                  Reset Password
              &lt;/h3&gt;
  
              &lt;p:outputPanel id="content" layout="block"&gt;
  
                  &lt;p&gt;
                      &lt;h:outputText value="Please enter your email address, a password of 8 characters or more and click 'Reset'." /&gt;
                  &lt;/p&gt;
  
                  &lt;h:form id="resetPasswordForm"&gt;
  
                      &lt;p:panelGrid columns="2" styleClass="invisible-middlealign"&gt;
  
                          &lt;p:panelGrid columns="2" styleClass="formatted" columnClasses="tdasheader, null"&gt;
  
                              &lt;h:outputText value="Email Address" /&gt;
                              &lt;p:inputText value="#{passwordResetBean.email}" size="40" 
                                  required="true" requiredMessage="Please enter your email address" /&gt;
  
                              &lt;h:outputText value="New Password" /&gt;
                              &lt;p:password value="#{passwordResetBean.password}" size="40" 
                                  required="true" requiredMessage="Please enter a new password" /&gt;
  
                          &lt;/p:panelGrid&gt;
  
                          &lt;p:commandButton value="Send" actionListener="#{passwordResetBean.resetPassword}" /&gt;
  
                      &lt;/p:panelGrid&gt;
  
                      &lt;h:messages style="color:red" /&gt;
                  &lt;/h:form&gt;
  
              &lt;/p:outputPanel&gt;
  
              &lt;ui:include src="/footer.xhtml" /&gt;
  
          &lt;/p:outputPanel&gt;
  
      &lt;/h:body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>and my backing bean:</p>
  
  <pre><code>    public PasswordResetBean() throws ApplicationException {
  
              uuid = FacesUtil.getRequestParameter("uuid");
      }
  
      public String getEmail() {
          return email;
      }
  
      public void setEmail(String email) {
          this.email = email;
      }
  
      public String getPassword() {
          return password;
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
      public void resetPassword(ActionEvent event) {
  
          try {
              boolean successful = securityService.resetPassword(email, password, uuid, userId);
  
              if (successful) {
                  FacesUtil.getHttpSession(true).setAttribute("passwordReset", true);
                  FacesUtil.redirect(FacesUtil.getServletRequest().getContextPath()+"/logon.xhtml");
              }
              else {
                  FacesContext context = FacesContext.getCurrentInstance();
                  FacesMessage message = new FacesMessage("The reset has failed. Please try again");
                  context.addMessage("resetPasswordForm", message);
              }
          }
          catch (Exception e) {
              handleException(e);
          }
      }
  }
  </code></pre>
  
  <p>and faces config:</p>
  
  <pre><code>&lt;managed-bean&gt;
      &lt;managed-bean-name&gt;passwordResetBean&lt;/managed-bean-name&gt;
      &lt;managed-bean-class&gt;com.encounter.security.ui.PasswordResetBean&lt;/managed-bean-class&gt;
      &lt;managed-bean-scope&gt;view&lt;/managed-bean-scope&gt;
      &lt;managed-property&gt;
          &lt;property-name&gt;securityService&lt;/property-name&gt;
          &lt;value&gt;#{securityService}&lt;/value&gt;
      &lt;/managed-property&gt;
  &lt;/managed-bean&gt;
  </code></pre>
  
  <p>Could someone please tell me where I'm going wrong?</p>
  
  <p>Thanks,
  Neil</p>