zoukankan      html  css  js  c++  java
  • freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]

    FreeMarker template error:
    The following has evaluated to null or missing:
    ==> product  [in template "product.html" at line 751, column 43]

    FreeMarker模板误差:
    以下已评估为null或丢失:
    =产品“模板”产品HTML“在第751行,第43栏]

    ----------------------------

    意思是有个值为null,就是不存在,

    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)??

    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)??
    -----------------
    提示:如果没有表达是合法的空/失踪,或者指定一个默认值myoptionalvar!mydefault,或使用< #如果myoptionalvar??>在< #别的>当失踪/ # <<如果>>。(这些仅覆盖的表达;最后一步覆盖整个表达式,使用parenthessis:(myoptionvar。Foo)!mydefault,(myoptionvar。Foo)?
     
    大概意思是应该进行判断,对象是否为空

    一般出现这种异常的原因为:如果对象为空,则freemarker就会抛出这个异常。

    其实解决很简单,在用对象之前先判空,不空在进行属性的获取操作即可

    原文地址

  • 相关阅读:
    小胖IT大讲堂之二 Hook实战(一) 魔兽改键工具
    介绍介绍草泥马
    ASP.NET服务端操作ActiveX报错灾难性故障的问题和解决办法
    ASP.NET网络映射驱动器无权限访问的解决方案
    Visual Studio快捷键
    4.2.8 Dating with girls(2)
    4.3.2 Prime Ring Problem
    4.2.3 Knight Moves
    4.2.1 Rescue
    4.2.7 Waiting ten thousand years for Love
  • 原文地址:https://www.cnblogs.com/tongs/p/7493382.html
Copyright © 2011-2022 走看看