Unescaped Text with th:placeholder

∥☆過路亽.° 提交于 2020-01-22 01:32:10

问题


In the current spring-boot / thymeleaf, some of the html views have a form where a field with like this is present:

<input type="text" name="sobrenome" class="form-control" th:placeholder="#{account.sobrenome}"/>

the value for account.sobrenome is placed on file message.properties:

account.sobrenome=&Uacute;ltimo nome

the problem is the application don't resolve the &Uacute; to Ú. When I use th:utext, i have no problems with this.

Anyone know how to use unescaped text with this tag th:placeholder?


回答1:


The issue is Spring Message treat &Uacute as seperate & U a c u t e letters and not as Ú.

Change the message to unicode as below

account.sobrenome=\u00daltimo nome

and use

th:placeholder="#{account.sobrenome}"


来源:https://stackoverflow.com/questions/32501163/unescaped-text-with-thplaceholder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!