开发者

How to format localized text in JSF

I'd like to keep localized text in a formatted manner (Using the <resource-bundle> in JSF)

For example:

in english.txt:

welcome_msg = <p>Hello <b>Friend</b></p>

in spanish.txt:

welcome_msg =开发者_如何学编程 <p> Ola <b>Hombre</b> commo esta? </p>

(Just random examples)

If I just use <h:outputText value="#{text.welcome_msg}" /> I will simply get the meta tags in the web page.

How can I achieve this?

Thanks!


By default, <h:outputText/> escapes the <, >, and & characters. Use the escape attribute to disable this:

<h:outputText value="#{text.welcome_msg}" escape="false"/>

Be aware that this is now a potential security hole, depending on the source of the text that you are outputting.

See also: http://download.oracle.com/javaee/6/javaserverfaces/2.0/docs/pdldocs/facelets/h/outputText.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜