JFinal 3.3 3.4 模板方法报错

用冷冷 maven3.3 3.4jfinal  在这段代码出问题 me.addSharedFunction("_common/common.html"); 此会出现错误


 Directive not found: #principal


Template: "/WEB-INF/views/index.html". Line: 41


 /**


     * 配置模板引擎


     *


     * @param me Engine


     */


    public void configEngine(Engine me) {


        //如果公共模板中有引用shiro标签,那么这个要在它之前


        initDirective(me);


        me.addDirective("userCount", UserCountTag.class);


        me.addSharedFunction("_common/common.html"); 此会出现错误


    }




    public static void initDirective(Engine me){


Set<Class<?>> classes = ClassUtil.scanPackageByAnnotation(null, true, DefineDirective.class);


for (Class<?> clazz : classes) {


DefineDirective defineDirective = clazz.getAnnotation(DefineDirective.class);


String tag = defineDirective.tag();


if (tag != null && !"".equals(tag)) {


me.addDirective(tag, (Directive) ClassUtil.newInstance(clazz));


} else {


LogKit.error("自定义Directive的标签为空无效:" + clazz.getName());


}


}


}






红色字体代码出现


严重: Exception starting filter jfinal








com.jfinal.template.stat.ParseException: Directive not found: #hasRole


Template: "_common/common.html". Line: 22


at com.jfinal.template.stat.Parser.stat(Parser.java:212)


at com.jfinal.template.stat.Parser.statList(Parser.java:101)


at com.jfinal.template.stat.Parser.stat(Parser.java:175)


at com.jfinal.template.stat.Parser.statList(Parser.java:101)


at com.jfinal.template.stat.Parser.parse(Parser.java:91)


at com.jfinal.template.EngineConfig.doAddSharedFunction(EngineConfig.java:92)


at com.jfinal.template.EngineConfig.addSharedFunction(EngineConfig.java:87)


at com.jfinal.template.Engine.addSharedFunction(Engine.java:238)


at io.github.wx.core.config.LmsCoreConfig.configEngine(LmsCoreConfig.java:78)


at com.jfinal.core.Config.configJFinal(Config.java:53)


at com.jfinal.core.JFinal.init(JFinal.java:63)


at com.jfinal.core.JFinalFilter.init(JFinalFilter.java:49)


at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)


at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)


at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)


at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4854)


at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5546)


at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)


at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)


at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)


at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)


at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1258)


at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1918)


at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)


at java.util.concurrent.FutureTask.run(FutureTask.java:262)


at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)


at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)


at java.lang.Thread.run(Thread.java:745)




五月 14, 2018 12:55:24 上午 org.apache.catalina.core.StandardContext startInternal


评论区

热门反馈

扫码入社