相关疑难解决方法(0)

Thymeleaf + Spring:如何保持断线?

我正在使用带弹簧的Thymeleaf模板引擎,我想显示通过多行textarea存储的文本.

在我的数据库中,多行字符串存储为"\n",如下所示:"Test1 \nTest2 \n ......"

用th:text得到了:"Test1 Test2"没有换行符.

如何使用Thymeleaf显示换行符并避免手动"\n"替换为<br />然后避免使用th:utext(这种开放形式到xss注入)?

谢谢 !

spring spring-el thymeleaf

21
推荐指数
4
解决办法
2万
查看次数

标签 统计

spring ×1

spring-el ×1

thymeleaf ×1