我有這個速度模板。它在一種情況下工作正常,但不在另一種情況下。如果我刪除elseif
它工作正常。有沒有人遇到過這個?問題elseif在速度
#if (some condition)
## Do something
#elseif
## Do something else
#end
我有這個速度模板。它在一種情況下工作正常,但不在另一種情況下。如果我刪除elseif
它工作正常。有沒有人遇到過這個?問題elseif在速度
#if (some condition)
## Do something
#elseif
## Do something else
#end
我不知道速度,但通常使用elseif
第二個條件。
else
似乎是你所需要的。
#if (some condition)
## Do something
#else
## Do something else
#end
您可以參考這個: Apache Velocity User Guide
基本上它具有根據以下情況之一去:
#if (condition)
##do something
#end
#if (condition)
##do something
#else
##do something
#end
#if (condition)
##do something
#elseif (condition)
##do something
#else
##do something
#end
(如果 - elseif的-....-其他梯子長度可以很長)
如果您使用的是#elseif
語句,那麼您應該確保您正在檢查中的某些條件聲明。
如: -
#if (some condition)
## Do something
#elseif (some condition)
## Do something
#else
## Do something else
#end
這是正確的。正確的語法是#elseif(othercondition),或者只使用#else。 – 2010-10-10 04:27:38