在freemarker静态页面模板引擎中,在通用页面common.ftl文件中说${ctx}是空的找不到相对路径,你可以进行如下操作:
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}
<#assign ctx = "${request.contextPath}">