编写html,注意字符串与数据拼接用单引号
<!DOCTYPE HTML> <html xmlns:th="http://www.thymeleaf.org"> <head> <title>SpringBoot模版渲染</title> <link rel="icon" type="image/x-icon" href="/images/mldn.ico"/> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> </head> <body> <p th:text="'官方网站:' + ${url}"/> <p th:utext="'官方网站:' + ${url}"/> <hr/> <h2 th:text="#{welcome.url}"/> <h2 th:text="#{welcome.msg('bonc')}"/> <hr/> <p th:utext="'官方网站:' + ${url} + '、数学计算:' + (1 + 2)"/> </body> </html> |
Thymeleaf已经把开发中常用的需求都考虑到了