using thymeleaf之一thymeleaf认识

来源:互联网 发布:网络管理与通信软件 编辑:程序博客网 时间:2024/05/29 07:42

目前,国内thymeleaf中文资料很少,很惊喜做第一个吃螃蟹的人。

1.thymeleaf认识

1.1介绍一下什么是thymeleaf

thymeleaf是基于java的模板引擎,支持xml/xhtml/html5。

1.2thymeleaf解析原理

lthymeleaf在指定的模式下处理文件之前会首先将文件转换为格式良好的XML文件,而此XML文件仍然是完全有效的HTML5.
l解析xml方式为SAX.所以web页面要求严格格式,一定要有封闭标签:/> 或 </>
1.3 it looks like this:

<!DOCTYPE html><html xmlns:th="http://www.thymeleaf.org"><head><meta charset="UTF-8" /><title th:text="${welcome}">thymeleaf</title><script type="text/javascript"  th:src="@{/webjars/jquery/1.11.1/jquery.min.js}"></script></head><script th:inline="javascript">/*<![CDATA[*//*]]>*/</script><body th:inline="text"><div><ol><li><a th:href="@{/operator-page}" target="_blank">算术运算符</a></li><li><a th:href="@{/operator-equal-page}" target="_blank">比较和相等运算符</a></li><li><a th:href="@{/operator-boolean-page}" target="_blank">布尔运算符</a></li></ol></div></body></html>



1 0
原创粉丝点击