本人用的是JFinal-3.4。java
在JFinal框架中使用FreeMarker渲染视图时,报 Caused by: java.lang.ClassNotFoundException: freemarker.template.TemplateException。框架
第一步:配置JFinal常量maven
public void configConstant(Constants constants) { constants.setDevMode(true); // 因为JFinal-3.4 默认使用 ViewType.JFINAL_TEMPLATE,此时须要改成 ViewType.FREE_MARKER constants.setViewType(ViewType.FREE_MARKER); }
第二步:引入freemarker-2.3.20依赖(若是不作此步操做,仍然会报一样的错误)【重点】spa
<dependency> <groupId>org.freemarker</groupId> <artifactId>freemarker</artifactId> <version>2.3.20</version> </dependency>
注:若是你不是使用的maven构建的项目的话,需手动下载freemarker-2.3.20.jar,并引入到项目中来。code