java JSF - <h:outputText> 将一些单词加粗
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2467750/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JSF - <h:outputText> making some of words Bold
提问by karansardana
How can we go about making some of the words in a sentence appear in BOLD
我们如何才能使句子中的某些单词以粗体显示
for example - I'm trying to put one of the words of a sentence in BOLD i.e.
例如 - 我正在尝试将句子中的一个词放在 BOLD 中,即
sentence is "please select the amount"
句子是“请选择金额”
amount should be in BOLD, and now, when I use
数量应该是粗体,现在,当我使用
message = "please select the <b>amount </b>"
This doesn't work. It simply shows
这不起作用。它只是显示
please select the <b>amount </b>.
How can I get this to work?
我怎样才能让它工作?
回答by stacker
Setting the escape attribute to false allows you to insert html tags
将转义属性设置为 false 允许您插入 html 标签
<h:outputText escape="false" value="please select the <b>amount</b>"/>

