RadioButton + JSP

I am doing an project named an online exam.

I have various questions say about 10 questions.And there are 4 radiobutton are given as option.In the next page I want to retrive the answers clicked by the user for each of the question.I am getting the values from the database ie, the questions and answers(the options)

The code for the first page

<%@ page language="java"%><%@ page import="java.sql.*,java.io.*,java.util.*,javax.servlet.*"%>

<%@ include file="dbconnection.jsp"%>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<meta name="GENERATOR" content="Microsoft FrontPage 5.0">

<meta name="ProgId" content="FrontPage.Editor.Document">

<title>New Page 1</title>

<script language="javascript">

function insertproduct()

{

window.location="dbquestion.jsp";

}

</script>

</head>

<%!

String qid,ans1,ans2,ans3,ans4;

%>

<body>

<%

String id=request.getParameter("id");

String str="select * from qa_bank where TOPIC_ID='"+id+"'";

PreparedStatement ps=con.prepareStatement(str);

ResultSet rs=ps.executeQuery();

%>

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1">

<%

while(rs.next())

{

qid=rs.getString(1);

ans1=rs.getString("ANSWER1");

ans2=rs.getString("ANSWER2");

ans3=rs.getString("ANSWER3");

ans4=rs.getString("ANSWER4");

%>

<form name="frm">

<tr>

<td ><%=rs.getString("QUESTION")%> </td>

</tr>

<td >

</td>

</tr>

</table>

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber2">

<tr>

<td width="50%"><input type="radio" value="<%=ans1%>" name="R1"><%=rs.getString("ANSWER1")%></td>

<td width="50%"><input type="radio" value="<%=ans2%>" name="R1"><%=rs.getString("ANSWER2")%></td>

</tr>

<tr>

<td width="50%"><input type="radio" value="<%=ans3%>" name="R1"><%=rs.getString("ANSWER3")%></td>

<td width="50%"><input type="radio" value="<%=ans4%>" name="R1"><%=rs.getString("ANSWER4")%></td>

</tr>

<tr>

<td width="50%"> </td>

<td width="50%"> </td>

</tr>

</table>

</form>

<%}%>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber2">

<tr>

<td><p align="center"><a href="dbquestion.jsp">SUBMIT

</td>

</tr>

</body>

</html>

Could anybody help me in giving the code for next page,ie to get the values clicked by user for each questions.

My mail id is mgrahul@yahoo.co.in

I expect response from all as early as possible.

Thank u

[3433 byte] By [mgrahula] at [2007-11-27 7:59:35]
# 1

No one's going to mail you, you might as well make the effort to visit the forums after we make the effort to answer you :D

You've already used request.getParameter() and so I guess you know what that does.

That's your solution, getParameter("R1"). Figure out the rest, it's easy.

nogoodatcodinga at 2007-7-12 19:41:38 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...