1.控制器
@Controller public class HelloController { private Logger logger = LoggerFactory.getLogger(HelloController.class); /** * 测试hello * @return */ @RequestMapping(value = "/hello",method = RequestMethod.GET) public String hello(Model model) { model.addAttribute("name", "Dear"); return "hello"; } }
2.view
<!DOCTYPE HTML> <html xmlns:th="http://www.thymeleaf.org"> <head> <title>hello</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <!--/*@thymesVar id="name" type="java.lang.String"*/--> <p th:text="'Hello!, ' + ${name} + '!'" >3333</p> </body> </html>
博客出处:http://blog.csdn.net/u012706811/article/details/52185345