2021年8月6日 FreeMarker报错:Backing out from the root directory is not allowed.
Mahalalel 发布于 阅读:4497 Freemarker
1、问题
FreeMarker template error (DEBUG mode; use RETHROW in production!):
Template inclusion failed (for parameter value "../common/header.ftl"):
Template not found for name "../common/header.ftl".
Reason given: Backing out from the root directory is not allowed.
原因:Backing out from the root directory is not allowed.
FreeMarker没法引入配置模版文件目录的上层文件夹中的模板文件.
2、排查
2-1、ftl文件引入
错误的引用:
<#include "../common/header.ftl"/>
2-2、后台返回
@GetMapping("/login")
public String login(Model model) {
return "admin/system/login";
}
2-3、ftl引用修改
<#include "/admin/common/header.ftl"/>