- session封装简单string字符串
controller层
request.getSession().setAttribute("accountName", account.getUsername());
HTML
<a th:text="${session.accountName}">
- session封装自定义实体类
controler层
request.getSession().setAttribute("report",report);
HTML
<a th:text="${session.report.tm}"></a>
- session封装自定义实体类集合
controller层
request.getSession().setAttribute("hebeiZbggs", hebeiZbggs);
HTML
<table width="100%" border="0" cellpadding="0" cellspacing="0"> <th:block th:each="hebeiZbgg : ${session.hebeiZbggs}"> <tr> <td width="33" height="10" align="right"><img th:src="@{../img/333.png}" width="25" height="25"></td> <td> <a th:href="@{/detail(str=${hebeiZbgg.toStringC()})}" class="a3" th:text="${hebeiZbgg.tm}"> </a> </td> </tr> <tr bgcolor="#E3EDF6"> <td height="10" align="center"> </td> <td class="txt1"> 发布时间:<span class="txt" th:text="${hebeiZbgg.fbsj}"></span> 地域:<span class="txt" th:text="${hebeiZbgg.cgrdz}">石家庄市裕华区雅清街30号</span> 采购人:<span class="txt" th:text="${hebeiZbgg.cgrmc}">河北省环境监测中心</span> </td> </tr> </th:block> </table>