[英]ognl 'in' statement not functioning as expected
我有以下代碼:
<s:iterator value="primaryDataSources" var="includedPrimaryDataSource">
<s:property value="%{includedPrimaryDataSource in primaryDataSources}"/>
</s:iterator>
與primaryDataSources是在我的動作類中初始化的ArrayList:
List<String> primaryDataSources = new ArrayList<String>(Arrays.asList(new String[]{"SE", "QBP", "Olympic", "J&B"}));
當我像這樣自行輸出primaryDataSources時:
<s:property value="%{primaryDataSources}"/>
它輸出[SE,QBP,Olympic,J&B]
我希望'in'ognl語句始終返回true,但是始終為false ...知道我在做什么錯嗎?
您缺少#
引用您的includedPrimaryDataSource
,在<s:property>
標記內也不需要%{...}
。
<s:iterator value="primaryDataSources" var="includedPrimaryDataSource">
<s:property value="#includedPrimaryDataSource in primaryDataSources"/>
</s:iterator>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.