title: How to display Spring MVC form errors for class error
body: <p>I'm familiar with using Spring's <code>&lt;form:errors&gt;</code> tags to display validation errors for object properties, but how do you display an error at the class level?</p>
  
  <p>Here's an example of what I'm talking about:</p>
  
  <pre><code>@ScriptAssert(lang = "javascript", 
          script = "_this.isExistingEmployee == true || (_this.phoneNumber != null &amp;&amp; _this.address != null)", 
          message = "New hires must enter contact information")
  public class JobApplicationForm {
  
      @NotBlank(message = "First Name is required")
      private String firstName;
  
      @NotBlank(message = "Last Name is required")
      private String lastName;
  
      @NotNull(message = "Please specify whether you are an existing employee in another area")
      private Boolean isExistingEmployee;
  
      private String phoneNumber;
  
      private String address;
  }
  </code></pre>
  
  <p><code>@ScriptAssert</code> here just confirms that if the applicant has indicated that they are an existing employee they can skip the contact info, but if not they must enter it. When this validation fails, the error is not on a given field but rather is on the class.</p>
  
  <p>Within the form, I can show an error on a field with <code>&lt;form:errors path="firstName"&gt;</code> and I can display all errors (class and field) at once using <code>&lt;form:errors path="*"&gt;</code> but how can I isolate and display class level errors?</p>