title: Best Practice of redirecting in Spring Controller
body: <p>Here I have to controller methods for example,</p>
  
  <p>(Case 1) One way is </p>
  
  <pre><code>@Controller
  @requestMapping("main")
  Class ControllerClass{
  
      @RequestMapping("first", method = RequestMethod.POST)
      public String post(Model model){
         //processing  
         return "redirect:second";
      }
  
      @RequestMapping("second", method = RequestMethod.GET)
      public String post(Model model){
         //processing  
         return "myview";
      }
  }
  </code></pre>
  
  <p>And (Case 2) another way is</p>
  
  <pre><code>@Controller
  @requestMapping("main")
  Class ControllerClass{
  
      @RequestMapping("first", method = RequestMethod.POST)
      public String post(Model model){
         //processing  
         return "redirect:/main/second";
      }
  
      @RequestMapping("second", method = RequestMethod.GET)
      public String post(Model model){
         //processing  
         return "myview";
      }
  }
  </code></pre>
  
  <p>Both ways work correctly, but I want to know which one is better to avoid future problems like one I faced recently:</p>
  
  <p>When I forwarded the request to <strong>/main/first</strong> from another controller, I got a 404 error in code which is using Case 1.  </p>