我在String变量中有一些文本,其中包含回车符和新行\r\n.
text = "Text1\r\nText2\r\nText3";
Run Code Online (Sandbox Code Playgroud)
我用它来呈现它<h:outputtext>.
<h:outputText value="#{bean.text}" />
Run Code Online (Sandbox Code Playgroud)
但它无法识别新的行字符,并在webbrowser中显示如下.
Text1 Text2 Text3
为什么不<h:outputText>打破\n新线?
我该怎么办?我一定要更换\n有<br />?