title: uploaded image does not display until I refresh the page Spring Mvc
body: <p>I'm using spring mvc with thymeleaf to upload an image to the server and display it after submitting the form in a separate page "result". </p>
  
  <p>the problem is the image is not displayed until I refresh resources folder "resources/static/images" in Spring Tool Suite and then refresh the page.
  I modified eclipse workspace options to refresh automatically and the ide part solved but still need to refresh the result page to get the image displayed </p>
  
  <p>This is the controller code</p>
  
  <pre><code>@RequestMapping(value = "/save", method = RequestMethod.POST)
  public String contentSubmit(@Valid @ModelAttribute ContentEntity cm, BindingResult result,
          @RequestParam("file") MultipartFile file, Model model) {
      if (!file.isEmpty()) {
          try {
              cm.setImgUrl(file.getOriginalFilename());
              byte[] bytes = file.getBytes();
              BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(new File("src/main/resources/static/images/"+cm.getImgUrl())));
              stream.write(bytes);
              stream.close();
          } catch (Exception e) {
              //return error page
          }
      }
  
      if (result.hasErrors()) {
          return "cms";
      }
  
      contentDao.addContent(cm);
      return "view";
  }
  </code></pre>
  
  <p>and this is the view code </p>
  
  <pre><code>&lt;img th:src="@{'images/'+${contentEntity.imgUrl}}" class="image-responsive thumbnail" /&gt;
  </code></pre>