1

我有以下代码:

<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 语句总是返回真,但它总是假的......知道我做错了什么吗?

4

1 回答 1

1

您缺少#引用您的includedPrimaryDataSource,标签%{...}内也不需要。<s:property>

<s:iterator value="primaryDataSources" var="includedPrimaryDataSource">
    <s:property value="#includedPrimaryDataSource in primaryDataSources"/>
</s:iterator>
于 2013-03-15T12:16:01.707 回答