81,094
社区成员
发帖
与我相关
我的任务
分享
<form-bean name="testForm" type="org.apache.struts.validator.DynaValidatorActionForm">
<form-property name="radioList" type="java.lang.String[]"/>
</form-bean>
<html:form action="/userInvest.do">
<logic:iterate id="question" collection="${invest.questions}" indexId="index">
${index+1}.${question.questionName}<br/>
<logic:iterate id="answer" collection="${question.answers}">
<html:radio property="radioList[index]" value="${answer.answerId}">${answer.answerName}</html:radio>
</logic:iterate>
</logic:iterate>
</html:form>
public class RadiosForm extends ActionForm {
private final Map values = new HashMap();
public void setValue(String key, Object value) {
values.put(key, value);
}
public Object getValue(String key) {
return values.get(key);
}
}
<form-bean name="testForm" type="org.apache.struts.action.ActionFormBean">
<form-property name="radioList" type="com.myapp.form.RadiosForm"/>
</form-bean>
<html:form action="/userInvest.do">
<logic:iterate id="question" collection="${invest.questions}" indexId="index">
${index+1}.${question.questionName}<br/>
<logic:iterate id="answer" collection="${question.answers}">
<html:radio property='<%="value("+index+");"%>' value="${answer.answerId}">${answer.answerName}</html:radio>
</logic:iterate>
<br/><br/>
</logic:iterate>
</html:form>