JFinal项目中获取根目录

config类中定义方法:

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

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

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

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

你可能感兴趣的:(JFinal项目中获取根目录)