JFinal项目中获取根目录

config类中定义方法:

@Override
public void configHandler(Handlers me) {
me.add(new ContextPathHandler("base_path"));
}

然后在页面head标签中中添加:

<base href="${base_path}/" />

这样项目中的资源文件引用就不会出问题了

原文地址:https://www.cnblogs.com/liuxgnu/p/3535401.html