2019-05-07 16:06
@孤傲苍狼 classpath:... 这种配置在文档中都有, jfinal undertow 的文档极少,一定要仔细看完
2019-05-07 12:22
注意一下 configEngine 中的配置是与 undertow 的静态资源配置无关的
configEngien 中的 me.setToClassPathSourceFactory(),是指定 enjoy 引擎去 class path 或者 jar 包中寻找 模板文件,这里与静态资源无关,只找模板文件
而 me.setBaseTemplatePath("webapp"),是在找模板的时候,先给定一个前缀路径,相当于这个路径是配合 getTemplate(String fileName) 中的 fileName 生成一个: baseTemplatePath + fileName
注意区分这几者,不要混杂这些概念就好解决
2019-05-07 10:06
@haoran789 我看到你有一个 new RoleController()
controller 的 new 是要交给 jfinal 的, new 出来以后要初始化,否则是用不了的
例如,你在 new 出来的 RoleController 中使用了 setAttr 方法,而这个方法底层是用的 request.setAttribute(....), 而 request 是 null, 所以会引发 NPE
因此,我前面讲的,通过单步调试分分钟就可以定位到是 setAttr 用到底层的 requset 对象为 null 值