What is the syntax for if false in nVelocity?
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.
精彩评论