【Velocity】關於List中是否有某個值

使用contains函數即可判斷false、true

boolean java.util.List.contains(Object o)

Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that (o == null ? e == null : o.equals(e)).

樣例

#foreach($status in $map.order)
	<option value="$status" #if($!map.orderSelection.contains($status)) selected = "selected" #end>
		$!{orderStatus.getDesc($!{status})}
	</option>
#end
發佈了102 篇原創文章 · 獲贊 18 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章