title: Spring portlet mvc: @Valid does not seem to work
body: <p>I created a bean class and use it in my controller but it does not seem to work.
  Namely even though I enter an invalid age, <code>result.hasErrors</code> is still false.</p>
  
  <p>Bean class:</p>
  
  <pre><code>public class User{
      @Min(13)
      private int age;
      private String name;
  
      public int getAge() {
          return age;
      }
  
      public void setAge(int age) {
          this.age = age;
      }
  
      public String getName(){
              return name;
      }
  
      public void setName(String name){
              this.name = name;
      }   
  }
  </code></pre>
  
  <p>Controller snippet:</p>
  
  <pre><code>@ActionMapping(params = "myAction=validateUser")
      public void validateUser(ActionRequest request, ActionResponse response, ModelMap model, @ModelAttribute("user") @Valid User user, BindingResult result ){      
  
          if(result.hasErrors()){
              for(ObjectError oe : result.getAllErrors()){
                  System.out.println(oe.getDefaultMessage());
              }
          } else{
              //code
          }
      }
  </code></pre>
  
  <p>JSP:</p>
  
  <pre><code>&lt;form:form action="${registerUser}" method="post" commandName="user"&gt;
      &lt;b&gt;User&lt;/b&gt; 
      &lt;form:input path="age"/&gt;
      &lt;form:input path="name"/&gt;
      &lt;input type="submit" value="register"/&gt;
  &lt;/form:form&gt;
  </code></pre>
  
  <hr>
  
  <p>edit:
  My userRegistration-portlet.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:util="http://www.springframework.org/schema/util"
      xmlns:mvc="http://www.springframework.org/schema/mvc"
      xsi:schemaLocation="
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context-3.0.xsd
          http://www.springframework.org/schema/util
          http://www.springframework.org/schema/util/spring-util-3.0.xsd
          http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
          http://www.springframework.org/schema/mvc
          "&gt;
  
      &lt;mvc:annotation-driven /&gt; 
  
      &lt;import resource="spring-hibernate.xml"/&gt;
  
      &lt;context:component-scan base-package="comjohndoe.dao" /&gt;
      &lt;context:component-scan base-package="comjohndoe.model" /&gt;
      &lt;context:component-scan base-package="comjohndoe.service" /&gt;
      &lt;context:component-scan base-package="comjohndoe.util" /&gt;
      &lt;context:component-scan base-package="comjohndoecontroller" /&gt;
  
      &lt;bean class="org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter"/&gt;
  
      &lt;bean id="viewResolver"
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
          &lt;property name="viewClass"
              value="org.springframework.web.servlet.view.JstlView" /&gt;
          &lt;property name="prefix" value="/jsp/" /&gt;
          &lt;property name="suffix" value=".jsp" /&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>It's the mvc:spring-validation line that is giving me the: <code>cvc-complex-type.2.4.c the matching wildcard is strict, but no declaration can be found for the element mvc:annotation-driven.</code> error.</p>