thymeleaf 传递数据到js变量

1.controller

@RequestMapping(value = "message", method = RequestMethod.GET)  
   public String messages(Model model) {  
           model.addAttribute("message", "hello");  
           return "index";  
   } 

2.该方法不行

var m = ${message}; // not working  
alert(m);  

3.可行方法

  

你可能感兴趣的:(thymeleaf 传递数据到js变量)