thymeleaf 传递数据到js变量

如何把控制器传来的model中的值传递给js变量呢?

下面便会找到答案...


1.controller

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


2.not work

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


3.ok


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