title: Routing issue on post between controller : Right page loaded but wrong URL
body: <p>When I click on my first page submit button, the right destination page is displayed but with the wrong URL. It's still the URL of the first page : Indeed the htm page displayed is the right one : <code>topologieInstanceCouloir.html</code> but the url is <a href="http://localhost:8990/bus/topologie" rel="nofollow noreferrer">http://localhost:8990/bus/topologie</a> instead of <code>http://localhost:8990/bus/topologieInstanceCouloir</code>. That's why the <code>createForm</code> is not called. Do you have an idea of why that happens?</p>
  
  <p>I have a list <code>allTypesCle</code> in a <code>modelAttribute</code> element which is not filled the first time I display my web page. But when I submit the form, using the <code>addCouloir</code> method the list is well filled and displayed.</p>
  
  <p>I use Spring 4.2  through spring boot.</p>
  
  <p>Here is the previous controller code, mainly the validform (submit method)  routing to the htm page where my issue is.</p>
  
  <pre><code>@Controller
  @SessionAttributes(value = "topologie", types = { Topologie.class })
  @RequestMapping("/bus/topologie")
  public class TopologieController {
  
      private static final String VIEW_TOPOLOGIE = "topologie";
      private static final String VIEW_TOPOLOGIE_INSTANCECOULOIR = "topologieInstanceCouloir";
  ...
  @RequestMapping(method = RequestMethod.GET)
  public String createForm(
          @RequestParam(value = "fileTopo", required = false) String id,
          @ModelAttribute("topologie") Topologie topologie, Model model)
                  throws Exception {
  
      if (topologie == null) {
          topologie = new Topologie();
      }
  
      if (id != null) {
          loadTopoFromFile(topologie, id);
          topologie.setIsPassageCvs(Boolean.TRUE);
          final List&lt;String&gt; allVersionCadre = getAllCadreVersion(topologie);
          final List&lt;String&gt; allNatures = getAllNatures(topologie);
          model.addAttribute("allVersionCadre", allVersionCadre);
          model.addAttribute("allNature", allNatures);
      }
  
      model.addAttribute("topologie", topologie);
      return VIEW_TOPOLOGIE;
  }
  
      @RequestMapping(method = RequestMethod.POST, params = { "definirInstance" })
      public String validForm(final Topologie topologie,
              final BindingResult result, RedirectAttributes attr,
              HttpSession session, HttpServletRequest req) {
  
          logger.info("REST request to valid form : {}", topologie);
          topologieService.update(topologie);
  
          if (result.hasErrors()) {
              logger.info("Form has errors ! : {}", result);
              return VIEW_TOPOLOGIE;
          }
  
          attr.addFlashAttribute("topologie", topologie);
          return VIEW_TOPOLOGIE_INSTANCECOULOIR;
      }
  </code></pre>
  
  <p>here is the 2nd controller code :</p>
  
  <pre><code>@Controller
  @SessionAttributes(value = "topologie", types = { Topologie.class })
  @RequestMapping("/bus/topologieInstanceCouloir")
  public class TopologieInstanceCouloirController {
  
  private static final String VIEW_TOPOLOGIE_INSTANCECOULOIR = "topologieInstanceCouloir";
  
  private final Logger logger = LoggerFactory
          .getLogger(TopologieInstanceCouloirController.class);
  
  @ModelAttribute("allTypesCle")
  public List&lt;String&gt; getAllTypesCle() {
      logger.info("ModelAttribute to get all types Cle");
      return typesCleService.getAll();
  }
  
  @RequestMapping(method = RequestMethod.GET)
  public String createForm(
          @ModelAttribute("topologie") Topologie topologie, Model model)
                  throws Exception {
  
      if (topologie == null) {
          topologie = new Topologie();
      }
      model.addAttribute("topologie", topologie);
  
      return VIEW_TOPOLOGIE_INSTANCECOULOIR;
  }
  
  @RequestMapping(method = RequestMethod.POST, params = { "addCouloir" })
  public String addCouloir(@ModelAttribute("topologie") Topologie topologie,
          final Model model,
          final HttpServletRequest req) throws IOException {
      final String param = req.getParameter("addCouloir");
      logger.info("REST request to add Couloir : {}", param);
  
      return VIEW_TOPOLOGIE_INSTANCECOULOIR;
  }
  </code></pre>
  
  <p>And here is the html code :</p>
  
  <pre><code>    &lt;form action="#" th:action="@{/bus/topologieInstanceCouloir}"
          th:object="${topologie}" method="post" class="form-horizontal"&gt;
  ...
      &lt;div class="form-group" th:if="!${#lists.isEmpty(allTypesCle)}"&gt;
          &lt;label for="typeCles" class="col-sm-2 control-label"&gt;Types
              de clé&lt;/label&gt;
          &lt;div class="col-sm-6"&gt;
              &lt;div th:each="typeCle : ${allTypesCle}" class="checkbox"&gt;
                  &lt;label th:for="${#ids.next('typesCle')}"&gt; &lt;input
                      type="checkbox"
                      th:field="*{partitions[__${rowPartitionStat.index}__].instances[__${rowInstanceStat.index}__].typesCle}"
                      th:value="${typeCle}" class="checkboxTypeCles" /&gt; &lt;span
                      th:text="${typeCle}"&gt;...&lt;/span&gt;
                  &lt;/label&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>