title: Spring MVC portlet in Liferay 6.2, Model properties are null upon form post
body: <p>I've tried to clone a Spring MVC Portlet project but upon posting the form <code>todo</code> properties are all null.</p>
  
  <p>Repo is available on <a href="https://github.com/jzinedine/try_git/tree/master/reference/java/spring-porlet-mvc/spring3-portlet" rel="nofollow">Github</a>.</p>
  
  <p>Here is the Controller code</p>
  
  <pre><code>@Controller
  @RequestMapping("VIEW")
  public class ToDoListController {
  
      @RenderMapping
      public String view() {
          return "list";
      }
  
      @ActionMapping
      public void save(@Valid ToDo toDo, BindingResult result, @CookieValue("JSESSIONID") String jsessionid, 
              PortletSession session, ModelMap modelMap) {
          if (!result.hasErrors()) {
              // could use entityManager to persist; put in session for this example
              List&lt;ToDo&gt; toDos = (List&lt;ToDo&gt;) session.getAttribute("toDos");
              if (toDos == null) {
                  toDos = new ArrayList&lt;ToDo&gt;();
              }
              toDos.add(toDo);
              session.setAttribute("toDos", toDos);
  
              modelMap.put("msg", String.format("You added a TODO: %s", toDo.getTitle()));
          }
      }
  
      @ModelAttribute
      private ToDo loadModel() {
          return new ToDo();
      }
  }
  </code></pre>
  
  <p>Here is the View:</p>
  
  <pre><code>&lt;%@ page contentType="text/html" %&gt;
  &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
  &lt;%@ taglib prefix="portlet" uri="http://java.sun.com/portlet_2_0" %&gt;
  &lt;%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %&gt;
  
  &lt;c:if test="${msg ne null}"&gt;
      &lt;div class="portlet-msg-success"&gt;&lt;c:out value="${msg}" /&gt;&lt;/div&gt;
  &lt;/c:if&gt;
  
  &lt;portlet:actionURL var="save" /&gt;
  
  &lt;form:form modelAttribute="toDo" action="${save}" method="POST"&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;Add a TODO&lt;/legend&gt;
          &lt;div&gt;
              &lt;form:label path="title" cssStyle="display:block"&gt;Title:&lt;/form:label&gt;
              &lt;form:input path="title" /&gt;
              &lt;form:errors path="title" cssClass="portlet-msg-error" /&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;form:label path="due" cssStyle="display:block"&gt;Due (MM/DD/YYYY):&lt;/form:label&gt;
              &lt;form:input path="due" /&gt;
              &lt;form:errors path="due" cssClass="portlet-msg-error" /&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;form:label path="description" cssStyle="display:block"&gt;Description:&lt;/form:label&gt;
              &lt;form:textarea path="description" /&gt;
              &lt;form:errors path="description" cssClass="portlet-msg-error" /&gt;
          &lt;/div&gt;
          &lt;div&gt;
              &lt;input type="submit" value="Save" /&gt;
          &lt;/div&gt;
      &lt;/fieldset&gt;
  &lt;/form:form&gt;
  </code></pre>
  
  <p>And here is the Context:</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:mvc="http://www.springframework.org/schema/mvc"
      xsi:schemaLocation="http://www.springframework.org/schema/beans 
                          http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                          http://www.springframework.org/schema/mvc
                          http://www.springframework.org/schema/mvc/spring-mvc.xsd
                          http://www.springframework.org/schema/context 
                          http://www.springframework.org/schema/context/spring-context-2.5.xsd"&gt;
  
      &lt;mvc:annotation-driven validator="validator" /&gt;
  
      &lt;bean id="viewResolver"
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
          &lt;property name="cache" value="true" /&gt;
          &lt;property name="viewClass"
              value="org.springframework.web.servlet.view.JstlView" /&gt;
          &lt;property name="prefix" value="/WEB-INF/view/" /&gt;
          &lt;property name="suffix" value=".jsp" /&gt;
      &lt;/bean&gt;
  
  
      &lt;bean id="validator"
          class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" /&gt;
  
      &lt;bean id="annotationMethodHandlerAdapter"
          class="org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt;
          &lt;property name="webBindingInitializer"&gt;
              &lt;bean id="configurableWebBindingInitializer"
                  class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer"&gt;
                  &lt;property name="validator"&gt;
                      &lt;ref bean="validator" /&gt;
                  &lt;/property&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>=====================================================================<br>
  <strong><em>Update:</em></strong></p>
  
  <p>Here is the working version: <a href="https://github.com/jzinedine/FirstPortlet" rel="nofollow">https://github.com/jzinedine/FirstPortlet</a></p>