title: How to access model attribute in html page in Spring MVC?
body: <p>I have Spring MVC project where the views are html pages. I am setting model attribute in my Controller method but unable to access it on html view page.</p>
  
  <p>Here is my Controller method.</p>
  
  <pre><code>@RequestMapping(value = "/", method = RequestMethod.GET)
   public ModelAndView getData() {
  
    ModelAndView model =new ModelAndView();
    model.addObject("name", "Jack");
    model.setViewName("html/firstLayer.html");
    return model;
  
   }
  </code></pre>
  
  <p>This is how i am accessing it in my html page</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      var name1 ='${name}' ;
      console.log(name1);
   &lt;/script&gt;
  </code></pre>
  
  <p>But on console it is printing ${name}, it should print Jack. 
  Any help will be appreciated , Thanks.</p>