You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Princeton Lau <pl...@wei.org> on 2001/08/03 18:31:59 UTC

Radio buttons as an iterated property

Hello all,

Is it possible to generate an indexed html:radio button?

I have tried the following code, but the tag does not recognize the index,
<%=j%>, that I am using...

Thanks,

Princeton


<%! int i=1;
    int j=0;%>

<logic:iterate name="PopulateQuiz" property="lQuestions" id="row">
  <tr>
    <td width="18"><b><%=i++%></b></td>
    <td class="T3" width="583" colspan="5"><b><bean:write name="row"
property="question" 		filter="true"/></b></td>
  </tr>
  <tr>
    <td align="left" width="18">
    </td>
    <td align="left" width="18">
    </td>
    <td class="table_row_color" align="left" width="117">
        <html:radio property="lAnswers[<%=j%>]" value="1" />1-Strongly
Disagree
    </td>
    <td class="table_row_color" align="left" width="117">
        <html:radio property="lAnswers[<%=j%>]" value="2"/>2-Disagree
    </td>
    <td class="table_row_color" align="left" width="117">
        <html:radio property="lAnswers[<%=j%>]" value="3"/>3- Not Applicable
    </td>
    <td class="table_row_color" align="left" width="116">
        <html:radio property="lAnswers[<%=j%>]" value="4"/>4-Agree
    </td>
    <td class="table_row_color" align="left" width="116">
        <html:radio property="lAnswers[<%=j%>]" value="5"/>5-Strongly Agree
    </td>
  </tr>
  <tr height="5">
    <td width="18" ></td>
    <td width="583" colspan="5"></td>
  </tr>
</logic:iterate>
  <tr>
    <td width="18"></td>
    <td align="center" colspan="5">
      <html:submit>
        <bean:message key="button.save"/>
      </html:submit>
      <html:reset>
        <bean:message key="button.reset"/>
      </html:reset>
    </td>
  </tr>

</table>