什么是一个没有语法真的还是假的,如果在nVelocity(或速度)?

语句

和更重要的是,在这里是这样的在nVelocity文档?我一直在谷歌上搜索了好一会儿也没有用。

我试图几个不同的组合,例如:

#if (!$artist.IsFestival)

$artist.FestivalName

#end

#if ($artist.IsFestival == false)

$artist.FestivalName

#end

这么折腾!

提前感谢!

-ev

有帮助吗?

解决方案

这两个应该有工作,所以我想你可能访问“isFestival”的问题。你应该尝试的豆语法$artist.festival或方法的语法$artist.isFestival()(现在使用的是两者的混合)。 该方法返回一个布尔值,是吗?

有关调试尝试刚刚打印出来的结果,看看它的工作原理:

 $artist            ## see if the artist is defined
 $artist.IsFestival  ## maybe an error   
 $artist.festival    ## should be true or false
 $artist.isFestival() ## should be true or false

更新:刚读你问nVelocity。这可能是我的回答只适用于Java版本。给它一个想试试。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top