好多人 都说:

在配置文件中加入 

spring.freemarker.request-context-attribute=request

在页面就可以

<#assign ctx=request.contextPath />

但是发现前台依然为 null(可能是我的配置有问题)

后来发现可以这样使用

<#assign ctx=springMacroRequestContext.contextPath />

不需要多余的配置

在Spring Boot+ Freemarker 中获取项目根目录

在Spring Boot+ Freemarker 中获取项目根目录

相关文章:

  • 2021-08-09
  • 2022-02-04
  • 2021-12-01
  • 2021-07-29
  • 2021-12-21
  • 2022-12-23
  • 2021-07-05
猜你喜欢
  • 2022-12-23
  • 2021-11-19
  • 2022-01-07
  • 2022-12-23
  • 2021-11-29
  • 2021-11-29
  • 2022-12-23
相关资源
相似解决方案