簡體   English   中英

nVelocity中的if的語法是什么?

[英]What is the syntax for if false in nVelocity?

nVelocity(或Velocity)中的not或false if語句的語法是什么?

更重要的是,這在nVelocity文檔中在哪里? 我搜索谷歌已經有一段時間了,但沒有成功。

我嘗試了幾種不同的組合,例如:

#if (!$artist.IsFestival)

$artist.FestivalName

#end

#if ($artist.IsFestival == false)

$artist.FestivalName

#end

太令人沮喪了!

提前致謝!

-ev

這兩個都應該起作用,所以我認為您在訪問“ isFestival”時可能會遇到問題。 您應該嘗試使用bean語法$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 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM