title: Spring - how do I get the page to refresh after a form is submitted?
body: <p>Using spring boot, I have a timetable page.</p>
  
  <p><a href="https://i.stack.imgur.com/cZgl7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cZgl7.png" alt="enter image description here"></a></p>
  
  <p>You can click a square, which opens up a small form with which you can add or remove the class objects from the timetable (which are saved in a database).</p>
  
  <p>My issue is, when you click 'add' (or remove), while it successfully adds/removes that object from the timetable, you have to refresh the page in order to see the class be added/removed on the timetable. It appears like nothing happens when add is clicked from the user's perspective (until they manually refresh the page).</p>
  
  <p>The post method redirects back to the timetable page get. I tried having it redirect to another mini get method, which then redirected back to the original timetable page; but from the browser side it still didn't look like anything was happening - just remaining on the same page with the original problem. Would love to hear a potential solution, thanks!</p>
  
  <p>Edit: Here's an example of my get and post methods:</p>
  
  <pre><code>@GetMapping("/timetable/{id}/{semId}")//This method displays timetable.
  public String timetable(@PathVariable(value = "id") String id, Model model,
          @PathVariable(value = "semId") String semId) {
  
  //code..
      model.addAttribute("x", x);
  
      return "timetable";
  
  }
  
  @PostMapping("/timetable/{id}/{semId}")
      public String timetablePost(@ModelAttribute TimetableClassDto dto, @PathVariable(value = "id") String id,
              Model model, @PathVariable(value = "semId") String semId) {
  //code..
  
      return "redirect://timetable/00/" + semId;
  
  }
  </code></pre>