输入类型=“文本"中的胸腺占位符表示为“文本". [英] Thymeleaf placeholder in input type="text"

查看:79
本文介绍了输入类型=“文本"中的胸腺占位符表示为“文本".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在

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

我想用占位符User的文本替换属性文件中的1个文本,但我不知道是否可能

I want to replace the text of the placeholder User for 1 text from the properties file, but I don't know if it is possible

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

推荐答案

有一个特定的Thymeleaf属性:

There is a specific Thymeleaf attribute for that:

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

它也可以这样写:

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

这篇关于输入类型=“文本"中的胸腺占位符表示为“文本".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆