
上网查了一下,基本都是用下面的方法, 但是 网页代码寸土寸金的, 这种写法也太丑陋了。 有什么优雅一点的解决办法吗?
<div th:text=”${T(com.example.demo.TestUtils).toUpperCase(‘hello world 1’)}”></div> <div th:text=”${T(com.example.demo.TestController).toLowerCase(‘HELLO WORLD 2’)}”></div> 谢谢建议,写完了。
Java端:
@Repository("stringUtil") public class StringUtil { Thymeleaf 端:
th:href="${@stringUtil.convert2Context(room.url)} 1 yangyaofei 2021-10-20 23:10:07 +08:00 via Android SpEl ? testutil 写个 bean,然后就可以直接调用了 |
2 cyndihuifei 2021-10-21 17:18:42 +08:00 当然是前后端分离啦 |