Play框架消息中的html标记 [英] html markup in Play Framework messages
本文介绍了Play框架消息中的html标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在Play中使用国际化消息文件.在我的messages.en文件中,我有:
I'm using the Internationalisation messages file in Play. In my messages.en file I have:
support.msg=Click here to contact <a href="support.html">support</a>
但这将输出为
<a href="support.html">support</a>
是否可以在messages.en文件中转义html,以便按原样输出
Is it possible to escape html in messages.en file so they are output 'as is'
推荐答案
默认情况下,播放!自动转义视图中使用的字符串.如果要输出原始文本(包括HTML),请将变量包装在Html()
中.
By default, Play! automatically escapes strings used in a view. If you'd like to output raw text (including the HTML), wrap the variable in Html()
.
<p>
@Html(article.content)
</p>
这篇关于Play框架消息中的html标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文