title: How to access Spring 3 MVC validator results in JSP without using form taglib
body: <p>I have a simple Spring 3 MVC form using jsp taglibs.  I need to add a class based on whether a field within the form has any errors associated with it or not.  Here is a snipet of my HTML:</p>
  
  <pre><code>&lt;div class="control-group error"&gt; &lt;!-- HERE: binding.hasErrors() ? "error" : "" --&gt;
      &lt;form:label path="username" cssClass="control-label"&gt;User Name&lt;/form:label&gt;
      &lt;div class="controls"&gt;
          &lt;form:input path="username" cssClass="span3"/&gt;
          &lt;form:errors path="username" cssClass="help-inline" /&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>So on the first line the class attribute has two classes "control-group" and "error".  I need to add error class only if that field has an error associated with it.  I know the WebDataBinder is included in the page somehow, but I don't know how to access it.  Essentially I just want to execute some good old fashion &lt;%= binding.hasError() ? "error" : "" %>, but how do I get access to the binder in the page?</p>