简体   繁体   English

JSF:\\ n或\\ n不能用语言包换行<br/>

[英]JSF: Line break with language bundle not possible with \n or <br/>

i got a language bundle and i want to throw an information message if saving is succesfull. 我有一个语言包,如果保存成功,我想抛出一条信息消息。 In the facelet i get the message like this: 在方面,我得到这样的消息:

<h:messages infoClass="info" errorClass="error" escape="false" /> 

And in the Backing Bean i wrote it like that: 在Backing Bean中,我这样写:

 fcxt.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, rb.getString("save_success"), null));

The language pattern for "save_success" is as following: “ save_success”的语言模式如下:

Saving successful! <br />You will receive your changes per email and also can have a look at this at your profile.

I also tried: 我也尝试过:

Saving successful! <br />You will receive your changes per email and also can have a look at this at your profile.

Did anyone know why there is no line break? 有谁知道为什么没有换行符? And how i can get a line break? 我怎么能换行?

There's no escape attribute in h:messages , so you may try using h:outputText like: h:messages没有escape属性,因此您可以尝试使用h:outputText例如:

<h:outputText value="#{MyBean.errMsg}" escape="false"/>

And try 并尝试

Saving successful! 保存成功! &lt;br/&gt; You will receive your changes per email and also can have a look at this at your profile. 您将通过电子邮件收到更改,也可以在您的个人资料中查看。

For the language pattern. 对于语言模式。 Where &lt; 其中&lt; stands for < and &gt; 代表<&gt; stands for > . 代表>

Also, you may check this to see the code example. 另外,您可以检查代码示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM