【发布时间】:2013-03-17 00:44:25
【问题描述】:
我有这个迭代器。
<s:iterator value = "myQuestions" status="key">
<s:property value="%{#key.index}" />
<h1><s:property value = "myQuestions[%{#key.index}].question"/></h1>
</s:iterator>
当迭代器对此进行迭代时
<s:property value="%{#key.index}" />
它显示正确的索引。但是当我在这个中添加%{#key.index}
<h1><s:property value = "myQuestions[%{#key.index}].question"/></h1>
它不显示处于该特定索引的元素。
假设当前索引为 0。
当我这样做<s:property value = "myQuestions[%{#key.index}].question"/> 时,它不会显示任何内容。但是当我硬编码它时。
<s:property value = "myQuestions[0].question"/> it displays the proper item. what am I missing?
【问题讨论】:
标签: java struts2 iterator jstl ognl