1
回答
JFinal在数据库中读取数据查不到该列的问题
华为云实践训练营,热门技术免费实践!>>>   

在读取一个数据表中的全部数据的时候,有一列数据总是无法显示,但是这列数据真实存在并且值不为NULL,请各位大神帮忙解答一些是什么原因

[ERROR]-[Thread: qtp1889735576-18]-[freemarker.log._Log4JLoggerFactory$Log4JLogger.error()]: Error executing FreeMarker template

FreeMarker template error:
The following has evaluated to null or missing:
==> i.crop_name  [in template "template/brand/detail.html" at line 64, column 50]


Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)??


The failing instruction (FTL stack trace):
----------
==> ${i.crop_name}  [in template "template/brand/detail.html" at line 64, column 48]
    #list applyId as i  [in template "template/brand/detail.html" at line 59, column 17]
    #nested  [in template "template/common/_mainlayout.html" in macro "mainlayout" at line 44, column 33]
    @mainlayout pageCSS=pageCSS pageJavas...  [in template "template/brand/detail.html" at line 46, column 1]
----------


Java stack trace (for programmers):
----------
freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]
at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:98)
at freemarker.core.EvalUtil.coerceModelToString(EvalUtil.java:382)
at freemarker.core.Expression.evalAndCoerceToString(Expression.java:115)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.MixedContent.accept(MixedContent.java:93)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:181)
at freemarker.core.Environment.visitIteratorBlock(Environment.java:509)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:103)
at freemarker.core.Environment.visitByHiddingParent(Environment.java:286)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:86)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.MixedContent.accept(MixedContent.java:93)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.Environment.visit(Environment.java:487)
at freemarker.core.BodyInstruction.accept(BodyInstruction.java:93)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.MixedContent.accept(MixedContent.java:93)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.Macro$Context.runMacro(Macro.java:209)
at freemarker.core.Environment.visit(Environment.java:694)
at freemarker.core.UnifiedCall.accept(UnifiedCall.java:116)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.MixedContent.accept(MixedContent.java:93)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.Environment.process(Environment.java:243)
at freemarker.template.Template.process(Template.java:277)
at com.jfinal.render.FreeMarkerRender.render(FreeMarkerRender.java:145)
at com.jfinal.core.ActionHandler.handle(ActionHandler.java:97)
at com.jfinal.ext.handler.ContextPathHandler.handle(ContextPathHandler.java:47)
at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:72)
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:722)
举报
lyra_vv587
发帖于1年前 1回/238阅
共有1个答案 最后回答: 1年前
怎么解决的呢,我的是因为我的表名使用了user , 才导致找不到字段,后来我把表名改成了 admin_user,才好了
--- 共有 3 条评论 ---
lyra_vv587回复 @赵明威 : 这个我没有用过= =用jfinal里面做查询的时候这种的时候我都是select 表名.*的,然后不加表名会出点问题。我也是一知半解你参考一下看看好了= = 1年前 回复
赵明威回复 @lyra_vv587 : 我用的是postgresql , 我把sql语句执行了一下发现了奇怪的事情,user是系统的表,select * from user 结果: |current_user| |--------------| |postgres| 1年前 回复
lyra_vv587你这样可能是因为表名和字段名重了?我是因为字段名写错了= =字母太顺手一直没看出来 1年前 回复
顶部