用的thymeleaf框架,前台html里怎么读取properties文件的值

用的thymeleaf框架,前台html里怎么读取properties文件的值,第1张

api里面说的是建一个与html同名的properties文件,里面是key=value格式,把这个文件放到与html路径一起,但是我也没实现,不知道是不是消息解释器的原因

原文:

>

找到解决办法了:

spring 配置:

springmessagesbasename=i18n/messages

springmessagescache-seconds= 3600

springmessagesencoding=UTF-8

这里已解决,在resources目录下建一个文件名i18n,里面有个文件messagesproperties,文件里面是key=value格式,然后直接使用就行了

参考这个的:>

一:基础对象

1ctx: the context object  

    ctx对象继承orgthymeleafcontextIContext或者orgthymeleafcontextIWebContext,取决于当前环境是不是web环境。

    如果程序集成了spring,那么将会是orgthymeleafspring[3|4]contextSpringWebContext

    #orgthymeleafcontextIContext

    ${#ctxlocale}

    ${#ctxvariables}

    #orgthymeleafcontextIWebContext

    ${#ctxapplicationAttributes}

    ${#ctx>

以上就是关于用的thymeleaf框架,前台html里怎么读取properties文件的值全部的内容,包括:用的thymeleaf框架,前台html里怎么读取properties文件的值、Thymeleaf调用Springboot bean的方法、第十一节:Thymeleaf内置对象等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/9523021.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-29
下一篇 2023-04-29

发表评论

登录后才能评论

评论列表(0条)

保存