- 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>
