java - 如何解决错误 :Left side ($point) of '>=' operation has null value

标签 java velocity

我面临的问题是偶尔Resourcenotfound/unable to 分析文件错误出现在速度页面上。

在记录之前,服务器日志中显示以下错误 resourcenotfound 异常:

“>=”操作的左侧 ($point) 具有空值。无法操作。

这里有与速度引擎相关的东西吗?

最佳答案

正如 Claude 提到的,问题出在 null 值上。

避免它,你可以先检查$points是否为空,然后做任何你想做的......

在这里使用 #if ($!points ...) 是更好的方法...

编辑

进一步解释,您的代码可能如下所示:

## Check whether the object represented by $points is null or not

#if ($!points)

    ## If $points exists, then perform your checks and calculations.

    #if ($points ...)
        ## Your business action
    #end

#end

关于java - 如何解决错误 :Left side ($point) of '>=' operation has null value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40233292/

相关文章:

java - 我在代码中使用 Object 父类(super class),但它抛出错误 constructor(int int) undefined

java - 如何使用 jsoup 从 html 元素获取字符串形式的 html 预览结果?

xml - 如何使用 Apache Velocity 进行 XML 转义?

java - JPA元模型生成问题

java - Integer 尝试修改它时抛出 NullPointer 异常

java - 关于使用 GAE + Spring + Velocity 的任何问题

java - 有什么工具可以将 zephyr 转换为速度模板?

java - Velocity 模板字符集

java - 为什么递归调用下的代码被处理了不止一次(当基本情况为真时)?

javascript - 使用 Javascript 动画库 VS 创建要在标题中注入(inject)的动态 <style> 标签