Radio button with values from a String ArrayList in JSP?

Radio button with values from a String ArrayList in JSP?

Radio button values in JSP

ArrayList<String> cs = CourseAssignments.getInstance().getStudentCoursesByName(sname); 
                 %>
                  <table border="1" cellspacing="1" cellpadding="8" bgcolor= #EBDDE2> 
                <%
                Iterator<String> i = cs.iterator();
                while(i.hasNext()){
                %>
                <tr>
                  <td><%= i.next() %><input type= "radio" name= "courses" value="<%= i.next() %>"/></td>
                </tr>
                <%}%>
            </table>
              <center><input type= "submit" value= "Submit"></center>
              </form>
                 <%}

In ArrayList cs I have all the courses that a student has. In a table I show these courses and it works if I don't use RADIO input. I want to display a radio button near each course, then user selects one and I will display the marks for that course.

I get: "org.apache.jasper.JasperException: An exception occurred processing JSP page /ComplexSearch/Seek.jsp at line 61

58:                 while(i.hasNext()){
59:                 %>
60:                 <tr>
61:                   <td><%= i.next() %><input type= "radio" name= "courses" value="<%= i.next() %>"/></td>
62:                 </tr>
63:                 <%}%>
64:             </table>
java.util.NoSuchElementException
    java.util.ArrayList$Itr.next(Unknown Source)
    org.apache.jsp.ComplexSearch.Seek_jsp._jspService(Seek_jsp.java:136)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
"
View Answers









Related Tutorials/Questions & Answers:
Radio button with values from a String ArrayList in JSP?
Arraylist from row values
Advertisements
pass radio button values to next page
Java radio buttons and button groups two values
Java radio buttons and button groups two values
Retrieve value of radio button from database to form
check radio button on retrieving the value from database.
Retrive values from an arraylist and display in a jsp?
Retrive values from an arraylist and display in a jsp?
radio button
JSP1
JSP2
how to pass input from radio button to jsp page
How to update table column from the values of Arraylist in java
Selecting a radio button in jquery autocomplete from database value
how to pass input from radio button to jsp page
how to pass input from radio button to jsp page
RADIO FROM JSP TO ACTION.
Remove duplicates from ArrayList
Protect JSPs from direct access
Radio Button in HTML
validation of radio button
Query on radio button
Using radio button in struts - Struts
Radio Button Problem in jsp.
How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST
Radio button Validation
Struts 2 Radio Button
radio button - Development process
dependent radio button
java radio button and exception
validate radio button using javascript
iPhone Radio Button Example
dispalying arraylist values in table form
passing value of radio button
radio button - Development process
access into radio button
set the arraylist values - Struts
get a value when a radio button clicked - JSP-Servlet
Radio Button in Java
How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST
How to Display next Record from Database "On the Click of Next Button" USING ARRAYLIST
How to Display Next question from database after clicking Next Button using "Arraylist concept"
radio button in jsp - JSP-Servlet
Radio button in JSP - JSP-Servlet
Dojo Radio Button
to get radio button value - Struts
Drop down and radio button value on edit action
passing values on button click
Remove checked checkboxes from arraylist and dipaly remaining arraylist

Ads