0
我有这个循环遍历一个对象的迭代器。Struts2标签单选按钮
<s:iterator value = "choices" status = "key">
<s:set var = "test" value ="%{#key.index}"/>
<input type = "radio" name="choices[{key.index}].answer" />
<s:textfield name = "choices[%{#key.index}].value" value = "%{choices[%{#key.index}].value}"/>
<br>
</s:iterator>
其中answer
是一个布尔值,我试图通过单选按钮进行设置。
,但问题是,当在生成的HTML,格兰单选按钮。就是这样
<input type = "radio" name="choices[%{#key.index}].answer" />
它没有足够的指数之/索引。它只是给了我%{#key.index}
+1,但编辑你S:属性的语法,这是错的 – 2013-03-28 08:40:53
编辑的语法 – Code2Interface 2013-03-28 08:44:25
还是错的:)你缺少引号,并加倍不应嵌套 – 2013-03-28 09:17:17