Skip to content Skip to sidebar Skip to footer

Multiple Choice Questions In Jsp

I am developing a webpage where i am going to conduct a small quiz based on plain JSP-MsAccess connection.But when I run my quiz and when I answer a question the result is applied

Solution 1:

Update your radio button name to use some index i.e.

At the top side: declare the index variable.

<% int qNum = 0; %>

In middle of page, use the index variable in radio field naming.

 <input type="radio" name="a<%=qNum%>" value="QA" />
 <input type="radio" name="a<%=qNum%>" value="QB" />
 <input type="radio" name="a<%=qNum%>" value="QC" />
 <input type="radio" name="a<%=qNum%>" value="QD" />

In the bottom of the page, retrieve the index parameter and increase the index by one.

 <% g=request.getParameter("a"+qNum);
    qNum++;
  %>

Post a Comment for "Multiple Choice Questions In Jsp"