我有这段代码遍历某个对象集合,我想instanceof
对每个元素执行类型检查(或)运算符。但是在我的<s:if>
,它似乎没有评估。我错过了什么?
<s:iterator value = "myQuestions" var = "q" status="key">
<s:checkbox name="myQuestions[%{#key.index}].chosen" />
<s:property value = "%{myQuestions[#key.index].question}"/>
<s:if test ="%{myQuestions[#key.index].getClass().simpleName} == 'Question'" >
THIS IS A QUESTION.
</s:if>
</s:iterator>