title: Setting up a JavaScript variable from Spring model by using Thymeleaf
body: <p>I am using Thymeleaf as template engine. How I pass a variable from Spring model to JavaScript variable?</p>
  
  <p>Spring-side:</p>
  
  <pre><code>@RequestMapping(value = "message", method = RequestMethod.GET)
  public String messages(Model model) {
      model.addAttribute("message", "hello");
      return "index";
  }
  </code></pre>
  
  <p>Client-side:</p>
  
  <pre><code>&lt;script&gt;
      ....
      var m = ${message}; // not working
      alert(m);
      ...
  &lt;/script&gt;
  </code></pre>