SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Oct 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    radio button return null value

    i am creating radio buttons using for loop.
    i try to get radio button values using for loop i get only null values plz help me...
    my jsp coding is
    <form method="post" action="evaluation" >
    <% int i,k=0;
    for(i=0;i<question.size();i++){
    %>
    <table>

    <tr><td colspan="2"><%=++k %> &nbsp;<%=question.get(i) %> <br/></td></tr>
    <%
    %>

    <tr>


    <td style="padding-left:10em">a)<input type=radio name="group+<%=i%>+" value="<%= a.get(i) %>" /></center></td>
    <td style="padding-right:5em">b)<input type=radio name="group+<%=i%>+" value="<%= b.get(i) %>"> </td> </tr>
    <tr>
    <td style="padding-left:10em">c)<input type=radio name="group+<%=i%>+" value="<%= c.get(i) %>"></td>
    <td>d)<input type=radio name="group+<%=i%>+" value="<%= d.get(i) %>"> <br/><br/></td>
    </tr>

    <%
    }

    ses.setAttribute("answer",ans);

    %>
    </table><center>
    <
    <input type="submit" name="submit" value="submit" /></center>
    </form>
    and my servlet coding is
    String[] userans=new String[10];

    for(int j=0;j<10;j++){
    userans[j]=request.getParameter("group"+j+"");
    System.out.println("group"+j+""+userans[j]);
    }
    in above coding only return null values pls anyone help me............

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,599
    Mentioned
    411 Post(s)
    Tagged
    7 Thread(s)
    What language is that? This needs to be moved to one of the programming forums, but I don't recognize the code.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •