Thymeleaf HTML5模板引擎

   Thymeleaf的模板还可以用作工作原型,Thymeleaf会在运行期替换掉静态值。例如下面的html文件,当作为静态文件时,product name显示为Red Chair,当运行在容器中并提供product这个对象时,product name的值会自动替换为product.description对应的值。

<!DOCTYPE html> 
<html xmlns:th="http://www.thymeleaf.org">
  <head>   
<title>Thymeleaf tutorial: exercise 13</title> 
  <link rel="stylesheet" href="../../../css/main-static.css" th:href="@{/css/main.css}" />   <meta charset="utf-8" />  </head> 
 <body>  
 <h1>Thymeleaf tutorial - Solution for exercise 13: inlining</h1> 
  <h2>Birthday email</h2>   
<form action="#" method="post">   
 <label for="body">Message body:</label> <textarea id="body" name="body" th:inline="text"> Dear [[${customerName}]],
it is our sincere pleasure to congratulate your in your birthday:  Happy birthday [[${customerName}]]!!!
See you soon, [[${customerName}]].
Regards,  The Thymeleaf team </textarea>
    <input type="submit" value="Send mail" /> 
  </form>  
</body> 
</html>
<input data-validation-matches-message="Text from messages resources" />
<input th:attr="data-validation-matches-message=\'' + #{user.notfound}" + '\''"/>
解决地址:http://stackoverflow.com/questions/21801158/thymeleaf-custom-attribute

 

转载于:https://my.oschina.net/wangnian/blog/648118

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值