title: Spring MVC + Apache tiles, form validation and redirect
body: <p>I have a problem with redirecting page.</p>
  
  <p>Controller:</p>
  
  <pre><code>@Controller
  @RequestMapping("/user")
  public class UserController {
  
      @RequestMapping(method = RequestMethod.POST)
      public String processSubmit(@Valid User user,
              BindingResult result) {
  
          if (result.hasErrors()) {
  
                      return "userForm";
  
                      **It will show error - Could not resolve view with name 'userForm' in servlet with name 'dispatcher'**
  
  
                      return "redirect:user.htm";
  
                      **It will redirect page but without error messages**                                                    
  
          } else {
             **same problem here**
              return "userResult";
          }
      }
  
      @RequestMapping(method = RequestMethod.GET)
      public ModelAndView initForm(ModelAndView model) {
          User us = new User();
          model.addObject("user", us);
          return model;
  
      }
  
  }
  </code></pre>
  
  <p>dispatcher-servlet:</p>
  
  <pre><code>&lt;bean id="viewResolver"
      class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt;
      &lt;property name="viewClass"&gt;
          &lt;value&gt;
              org.springframework.web.servlet.view.tiles2.TilesView
          &lt;/value&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  &lt;bean id="tilesConfigurer"
      class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"&gt;
      &lt;property name="definitions"&gt;
          &lt;list&gt;
              &lt;value&gt;/WEB-INF/tiles.xml&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>web.xml:</p>
  
  <pre><code> &lt;servlet&gt;
          &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
          &lt;servlet-class&gt;
              org.springframework.web.servlet.DispatcherServlet
          &lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
          &lt;url-pattern&gt;*.htm&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>Without tiles is everything ok. But when I configure dispatcher to use tiles, redirecting dont work and I dont know how to fix it.</p>