<body>
<h1>thymeleaf使用</h1>
<h1 th:text="${admin}">这里是编写XXX的信息</h1>
<hr/>
<span th:text="${book.getName()}">book.name</span><br/>
<span th:text="${book.author.getAge()}">author.name</span>
<hr/>
<span th:text="${session.book.getName()}">session作用域的book</span><br/>
<hr/>
<!--list集合-->
<span th:text="${books.get(1).getName()}">list集合</span><br/>
<!--map集合-->
<span th:text="${map.get('zhangsan').getAge()}">map集合</span>
<h4>基本选择结构的使用</h4>
<!--if-->
<span th:if="${book.author.getAge()}>=20">你老了</span>
<!--取反-->
<span th:unless="${book.author.age}>=20">你还是小鲜肉</span>
<hr/>
<!--switch case="*"类似于default -->
<div th:switch="${book.author.getAge()}">
<span th:case="50">超滤机</span>
<span th:case="30">拖拉机</span>
<span th:case="*">小母鸡</span>
</div>
<hr/>
<h4>循环的使用</h4>
<select>
<!--each有三个参数 book临时变量,状态变量,要循环的数组-->
<!--bookstart称作状态变量,属性有:-->
<!--index:当前迭代对象的index(从0开始计算)-->
<!--count: 当前迭代对象的index(从1开始计算)-->
<!--size:被迭代对象的大小-->
<!--current:当前迭代变量-->
<!--even/odd:布尔值,当前循环是否是偶数/奇数(从0开始计算)-->
<!--first:布尔值,当前循环是否是第一个-->
<!--last:布尔值,当前循环是否是最后一个-->
<option
th
:each=
"book,bookstart :${books}"
th
:value=
"${bookstart.index}"
th
:text=
"${book.getName()}"
></option>
</select>
<br/>
<h3>单选按钮
</h3>
<input
type=
"radio"
name=
"bookname"
th
:checked=
"${book.getAuthor().getAge()}==20"
>西游记
<input
type=
"radio"
name=
"bookname"
th
:checked=
"${book.getAuthor().getAge()}==50"
>三国演义