title: Tiles and redirect in Spring MVC
body: <p>I am using Tiles 2 in my Spring 3 MVC application
  i defines a form :</p>
  
  <pre><code>     &lt;definition name="addcompany.htm" extends="baseLayout"&gt;
        &lt;put-attribute name="title"  value="Add Company"/&gt;
        &lt;put-attribute name="body"   value="/WEB-INF/jsp/addcompany.jsp"/&gt;      
    &lt;/definition&gt;
  </code></pre>
  
  <p>and :</p>
  
  <pre><code>addcompany.(class)=org.springframework.web.servlet.view.tiles2.TilesView
  addcompany.url=addcompany.htm
  </code></pre>
  
  <p>And here is my controller :</p>
  
  <pre><code>@RequestMapping(value="/addcompany.htm", method=RequestMethod.GET)
  public ModelAndView getForm() {
      logger.info("Getting form!");
      ModelAndView mav = new ModelAndView();
      logger.info("Loading form");
      Company cmp = new Company();
      mav.addObject("company",cmp);
      mav.setViewName("addcompany");
      return mav;
  }
  
  @RequestMapping(value="/addcompany.htm", method=RequestMethod.POST)
  public String  postForm(@ModelAttribute("company") Company cmp) {
      logger.info("post form!");
      companyService.saveCompany(cmp);
      logger.info("post form");
      return "redirect:tiles:companylist"; // How do i redirect?
  }
  </code></pre>
  
  <p>Using Tiles2, the REDIRECT doesnt work.</p>
  
  <p>Any idea how to redirect after a successful POST using Tiles ?</p>
  
  <p>thanks</p>
  
  <p>EDIT :
  Solution is to add this in the views.properties :</p>
  
  <pre><code>redirectcompanylist.(class)=org.springframework.web.servlet.view.RedirectView
  redirectcompanylist.url=/companylist.htm
  </code></pre>
  
  <p>And return <strong>redirectcompanylist</strong> in the controller</p>