thymeleaf的简单使用

本文介绍了如何在Thymeleaf模板引擎中为下拉选择框(select)进行数据绑定和值设置,帮助开发者理解Thymeleaf在前端表单处理中的应用。
摘要由CSDN通过智能技术生成

给下拉框赋值

<select id="type" name="type" >
   <option value="0">请选择</option>
   <option th:each="post:${posts}" th:value="${post.key}" th:text="${post.value}"></option>
</select>

给A标签赋值

<td><a th:href="@{/emp/findall?pageNum=1}">查询所有</a></td>

<tr>
  <td><a href="findall?pageNum=1">首页</a></td>
  <td th:switch="${pageNum}">
	<p th:case="1">
	  <a th:href="@{/emp/findall?pageNum=1}">上一页</a>
	</p>
	<p th:case="*">
	  <a th:href="@{/emp/findall(pageNum=${pageNum-1})}">上一页</a>
	</p>
  </td>
  <td th:switch="${pageNum}">
	<p th:case="${count}">
	  <a th:href="@{/emp/findall(pageNum=${count})}">下一页</a>
	</p>
	<p th:case="*">
	  <a th:href="@{/emp/findall(pageNum=${pageNum+1})}">下一页</a>
	</p>
  </td>
  <td><a th:href="@{/emp/findall(pageNum=${count})}">尾页</a></td>
</tr>
加上如何做分页查询的代码(可能不好用,自己实现的)

//查询所有
	@RequestMapping("/findall")
	public String findAll(Model model,String pageNum
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值