struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zeswitz, Andrew" <AZesw...@icfconsulting.com>
Subject Nested iterator and radio button name
Date Fri, 18 Jul 2003 18:23:59 GMT
I'm having an issue getting radio buttons on a JSP to be named properly
using the iterate tags available in Struts 1.1.  I have a list of
questions; each question has a list of answers.  

The code is [supposed to be] looping through the primary list
(question), writing the pertinent data, performing a secondary loop
through the appropriate answers for that question and writing the
answers in the form of a radio button control.

The radio button naming should be something like the following:
Question[0].answer value="Yes" 
Question[0].answer value="No"

Instead, I'm receiving 
Question[0].answer value="Yes" 
Question[1].answer value="No"

The latter is not valid.

Here's the code.  Any thoughts?

Questions is an Array that is populated in the page context by my
LoadForm action.


            <nested:iterate id="sQuestion"
                    name="questions"
                    type="xxx.xxxx.xxx.xxx.common.dto.QuestionDTO"
                    indexId="index">
                 <nested:root name="sQuestion">
                <tr valign="top">
                    <td><%= index.intValue() + 1 %></td>
                    <td><nested:write name="sQuestion"
property="question"/></td>
                </tr>
                <tr>
                    <td></td>
                    <td>

                        <nested:iterate id="validResponse"
                                        name="sQuestion"
                                        property="validResponseList">
                            <nested:root name="validResponse">
                            <%  //if a long list, display vertically,
otherwise horiz
					  String sepChar =
"&nbsp;&nbsp;&nbsp;";
                                if(
sQuestion.getValidResponseList().size() > 2)
                                    sepChar = "<br>";
                            %>
                                <nested:radio name="sQuestion"
                                              property="answer"
                                              value="<%=validResponse%>"
 
indexed="true"/><%=validResponse + sepChar%>
</nested:root>
                       </nested:iterate>


                    </td>
                </tr>
             </nested:root>
            </nested:iterate>

NOTICE:
This message is for the designated recipient only and may contain privileged or confidential
information. If you have received it in error, please notify the sender immediately and delete
the original. Any other use of this e-mail by you is prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message