Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在html中替换\n message.properties_Properties_Thymeleaf - Fatal编程技术网

如何在html中替换\n message.properties

如何在html中替换\n message.properties,properties,thymeleaf,Properties,Thymeleaf,我正在使用message.properties进行多语言工作 在一个简单的html页面中,文本内容通过message.properties代码显示 但是当换行符\n标记在html页面中不起作用时 如何替换html中的\n消息属性 ex) //messages\u en.properties文件 index.main=我们让软件2.0成为人人都微笑的世界 //在html中 解决方案是将\n替换为,并使用th:utext属性而不是th:text,以便将消息呈现为HTML 除了标记,您可以使用ASC

我正在使用message.properties进行多语言工作

在一个简单的html页面中,文本内容通过message.properties代码显示

但是当换行符\n标记在html页面中不起作用时

如何替换html中的\n消息属性

ex)

//messages\u en.properties文件

index.main=我们让软件2.0成为人人都微笑的世界

//在html中


解决方案是将

\n
替换为

,并使用
th:utext
属性而不是
th:text
,以便将消息呈现为HTML


除了

标记,您可以使用ASCII码

并用
HTML标记包装邮件。

我解决了问题并尝试回复。谢谢你先回答。通过在属性文件中写入
标记,我用utext修复了它。谢谢。第一段是从另一个答案中抄来的,没有理解上下文<代码> 在标记中工作,但在属性文件中不工作。实际上,您是对的。Thymeleaf渲染

作为文本。但实际上,您可以在
HTML标记中使用ASCII标记,在这种情况下,您还需要在Thymeleaf中使用
th:utext
属性。我将修改我的答案。