怎么动态的选择单选框
通过 ionContext.getContext().put("subject", subject); put一个对象 然后通过取对象的值来选中该选的单选框
我这样写
答案: <input type="radio" name="subjectAnswer" value="A"
<s:if test="subject.subjectAnswer == 'A'">
checked="checked"
</s:if>
/>A
<input type="radio" name="subjectAnswer" value="B"
<s:if test="subject.subjectAnswer'B'">
checked="checked"
</s:if>
/>B
<input type="radio" name="subjectAnswer" value="C"
<s:if test="subject.subjectAnswer =='C'">
checked="checked"
</s:if>
/>C
<input type="radio" name="subjectAnswer" value="D"
<s:if test="subject.subjectAnswer =='D'">
checked="checked"
</s:if>
/>D
可是什么都得不到 加上# 也取不到
但是如果<s:property value="#subject.subjectAnswer"/> 这个就能取出想要的值
求大家帮帮忙
------解决方案--------------------
<s:property 是struts的标签吧。
------解决方案--------------------
<s:if test="${subject.subjectAnswer =='D'}">