2017-05-05 105 views
3

我有一个Thymeleaf占位符=“文本”

<input type="text" id="usernameId" name="username" placeholder="User" /> 

我要替换的占位符用户的文本1个文本从属性文件该输入文字,但我不知道如果有可能

<input type="text" id="usernameId" name="username" placeholder="th:text="#{user.placeholder}"" /> 

回答

7

没有为某个特定Thymeleaf属性:

<input type="text" id="usernameId" name="username" th:placeholder="#{user.placeholder}" /> 

它也可以写LIK e此:

<input type="text" id="usernameId" name="username" th:attr="placeholder=#{user.placeholder}" />