Jfinal 3.0 如何配置不适用模板引擎

jfinal配置文件中未配置使用模板引擎,前端使用了模板引擎,我后台render('list.html')的时候,后台给出了检查页面模板引擎的报错,如何配置能让jfinal不检查html中的模板引擎代码!

com.jfinal.render.RenderException: com.jfinal.template.stat.ParseException: Can not match the #end of directive #if

Template: "/WEB-INF/admin/user/list.html". Line: 56

at com.jfinal.render.TemplateRender.render(TemplateRender.java:63)

at com.jfinal.core.ActionHandler.handle(ActionHandler.java:99)

at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:74)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1476)

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)

at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)

at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)

at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)

at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)

at org.eclipse.jetty.server.Server.handle(Server.java:370)

at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)

at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971)

at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033)

at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)

at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)

at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)

at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667)

at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)

at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)

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

Caused by: com.jfinal.template.stat.ParseException: Can not match the #end of directive #if

Template: "/WEB-INF/admin/user/list.html". Line: 56

at com.jfinal.template.stat.Parser.matchEnd(Parser.java:84)

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

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

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

at com.jfinal.template.Engine.buildTemplateByFileStringSource(Engine.java:151)

at com.jfinal.template.Engine.getTemplate(Engine.java:133)

at com.jfinal.render.TemplateRender.render(TemplateRender.java:61)

... 25 more


评论区

JFinal

2017-04-10 23:11

注意看一下 jfinal 手册有关模板引擎这一章,如果希望模板内容不被解析,可用一下非解析块,用法如下:
#[[
这里是任意内容,内容可以是模板引擎的指令,但不会被解析
]]#

家住海边

2020-03-06 15:24

Can not match the #end of directive #main

家住海边

2020-03-06 15:25

这个错误是怎么回事啊

/project/registration?type=6
com.jfinal.render.RenderException: com.jfinal.template.stat.ParseException: Can not match the #end of directive #main
Template: "/WEB-INF/project/travel_registration.html". Line: 2
at com.jfinal.render.TemplateRender.render(TemplateRender.java:63)
at com.jfinal.core.ActionHandler.handle(ActionHandler.java:99)
at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:74)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:453)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:560)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:365)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:748)

JFinal

2020-03-06 20:31

@家住海边 指令缺少 #end 块,例如 :
#if (...)

上面的例子中缺少 #end

注意要仔细检查,异常已经明确告诉了你错误在 travel_registration.html 文件 第 2 行

热门反馈

扫码入社