TspringBoot 中 Thymeleaf页面数据展示

1 , 第一种 th:value="${对象**.**属性}"

<div >
	用户姓名:<input th:value="${user.name}">
	<br/>
	用户年龄:<input th:value="${user.age}"/>
	<br/>
	用户生日:<input th:value="${user.birthday}"/>
	<br/>    时间转换
	用户生日:<input th:value="${#dates.format(user.birthday,'yyyy-MM-dd')}" type="text">
	<br/>
</div>
2 第二种     定义  th:object="${user}     th:value="*{属性}"
<div th:object="${user}">
	用户姓名:<input th:id="*{name}" th:name="*{name}" th:value="*{name}"/>
	<br/>
	用户年龄:<input th:value="*{age}"/>
	<br/>
	用户生日:<input th:value="*{#dates.format(birthday, 'yyyy-MM-dd hh:mm:ss')}"/>
	<br/>
</div>

猜你喜欢

转载自blog.csdn.net/weixin_43183496/article/details/106877135