关于配置SharedMethod后报错:Directive not found

image.png

engine的配置如上

image.png

EnjoyUtils 中定义了一个 aaa的方法,如上

image.png

模板中这样调用了aaa方法,如上

image.png

模板调用渲染是这样的,如上

然后就报下面的错误,是我哪里写的不对吗?

2021-04-10 11:16:10[ERROR]-[com.jfinal.core.ActionHandler.handle()]: com.hxjq.controller.HelloController.hello() : /hello
com.jfinal.template.stat.ParseException: Directive not found: #aaa
String template line: 1
	at com.jfinal.template.stat.Parser.stat(Parser.java:199)
	at com.jfinal.template.stat.Parser.statList(Parser.java:88)
	at com.jfinal.template.stat.Parser.parse(Parser.java:78)
	at com.jfinal.template.Engine.buildTemplateBySource(Engine.java:240)
	at com.jfinal.template.Engine.getTemplateByString(Engine.java:195)
	at com.jfinal.template.Engine.getTemplateByString(Engine.java:176)
	at com.hxjq.controller.HelloController.hello(HelloController.java:160)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.jfinal.aop.Invocation.invoke(Invocation.java:97)
	at com.jfinal.core.ActionHandler.handle(ActionHandler.java:90)
	at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:90)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)


评论区

杜福忠

2021-04-10 14:40

先把文档手册读上三遍以上再动手,https://jfinal.com/doc/6-7
JF的文档我全篇阅读应该有20+遍了。。。有朋友问我为啥对jf这熟悉了,因为我靠她吃饭,所以必须对她熟悉,文档读N遍,源码也读了N遍,代码细到函数知识点,画树图也手动画了N遍

zsw大伟

2021-04-12 11:08

#(aaa("测试"))

热门反馈

扫码入社