开发者

What is the syntax for if false in nVelocity?

开发者 https://www.devze.com 2022-12-19 19:40 出处:网络
What is the syntax for an not true or false if statement in nVelocity (or Velocity)? And more importantly, where is this in the nVelocity docs? I\'ve been Googling for quite a while to no avail.

What is the syntax for an not true or false if statement in nVelocity (or Velocity)?

And more importantly, where is this in the nVelocity docs? I've been Googling for quite a while to no avail.

I've tried several different combinations such as:

#if (!$artist.IsFestival)

$artist.FestivalName

#end

and 开发者_运维百科

#if ($artist.IsFestival == false)

$artist.FestivalName

#end

So frustrating!

Thanks in advance!

-Ev


Both of these should have worked, so I think you may have a problem accessing "isFestival". You should try the bean syntax $artist.festival or the method syntax $artist.isFestival() (you are now using a mix of both). The method returns a boolean, right?

For debugging try to just print out the result to see if it works:

 $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

Update: Just read that you are asking about nVelocity. It is possible that my answer only applies to the Java version. Give it a try anyway.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号