繁体   English   中英

ognl'in'语句未按预期运行

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM