spring boot使用freemarker頁面獲取系統路徑最簡配置

1、配置application.properties(最後一句起作用,前面湊數的)

spring.freemarker.template-loader-path=classpath:/templates/
spring.freemarker.suffix=.ftl
spring.freemarker.cache=false
spring.freemarker.charset=utf-8
spring.freemarker.request-context-attribute=request

2、頁面獲取方式: ${request.contextPath}

<link rel="stylesheet" href="${request.contextPath}/layui/css/layui.css"/>

 

 3、完事,簡單吧

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章