honeya51
06-15-2009, 12:00 PM
here is the code for my jsp
<%@ page import="java.sql.*,java.io.*,java.util.*" %>
<%!
Connection con = null;
PreparedStatement pst = null;
ResultSet rs=null;
%>
<%
/* String driver = application.getInitParameter("driver");
String url = application.getInitParameter("url");
String user = application.getInitParameter("user");
String pwd = application.getInitParameter("pwd"); */
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","vak","exam");
pst=con.prepareStatement("select * from verbal ORDER BY dbms_random.value");
rs=pst.executeQuery();
%>
<html>
<head>
<title>VERBAL EXAM</title>
<style type="text/css">
<!--
.style7 {
font-size: 24px;
color: #330099;
font-weight: bold;
}
.style8 {
font-size: 18px;
color: #990000;
}
.style9 {font-size: 16px}
-->
</style>
<script type="text/javascript">
var c=0
var t
function abc()
{
window.location = "http://localhost:8083/onlineexam/numerical.jsp";
}
function timedCount()
{
document.getElementById('txt').value=c;
if(c==10)
abc();
c=c+1;
t=setTimeout("timedCount()",1000);
}
</script>
</head>
<body onLoad="timedCount()">
<form id="f1" name="form1" method="post" action="numerical.jsp" >
<table width="975" height="362" border="0">
<tr>
<td width="10" height="218"><table width="741" border="0">
<tr>
<td width="237" height="212"><img src="images/logo.jpg" width="237" height="210" /></td>
<td width="231"><img src="images/bannerimg.jpg" width="752" height="210" /></td>
</tr>
</table></td>
</tr>
<tr bgcolor="#FFFFCA">
<td height="138"><div align="center" class="style7">
<p> </p>
<p>Verbal Ability </p>
<p align="right"><input type="text" id="txt" style="background-color:#FFFFCA"/></p>
<p align="left"><span class="style8">Sentence Completion Instructions:</span></p>
<p align="left"><span class="style8"><span class="style9"> The following sentences are incomplete.Choose the word or phrase that most correctly completes the sentence. </span></span></p>
<p align="left"> </p>
</div>
<table border="0" width="500px" cellspacing="2" cellpadding="4">
<%
int i=1;
while(rs.next())
{
%>
<tr>
<td width="26%"> <strong>Question:<%=i%></strong>.<%=rs.getString(1) %> <input type="text" name="que<%=i%>" style="visibility:hidden" value= "<%= rs.getString(1) %>" /></td>
<tr>
<td> <strong>a:</strong>
<input type="radio" name="q<%=i%>" value= "<%= rs.getString(2)%>" />
<%= rs.getString(2) %></td>
</tr>
<tr>
<td> <strong>b:</strong>
<input type="radio" name="q<%=i%>" value="<%= rs.getString(3)%>" />
<%= rs.getString(3) %></td>
</tr>
<tr>
<td> <strong>c:</strong>
<input type="radio" name="q<%=i%>" value="<%= rs.getString(4)%>" />
<%= rs.getString(4) %></td>
</tr>
<tr>
<td> <strong>d:
</strong>
<input type="radio" name="q<%=i%>" value="<%= rs.getString(5)%>" />
<%= rs.getString(5) %> </td>
</tr>
<tr>
<td><center>
<%
i++;
}
%>
<input type="submit" value="Next" name="submit" />
</center></td>
</tr>
</table>
<p> </p></td>
</tr>
</table>
</form>
</body>
</html>
<%
rs.close();
pst.close();
con.close();
%>
The problem is wen the function abc is called i,e the timeout happens the radio checked values are not being carried from first jsp to another jsp. so any solution could help me??
<%@ page import="java.sql.*,java.io.*,java.util.*" %>
<%!
Connection con = null;
PreparedStatement pst = null;
ResultSet rs=null;
%>
<%
/* String driver = application.getInitParameter("driver");
String url = application.getInitParameter("url");
String user = application.getInitParameter("user");
String pwd = application.getInitParameter("pwd"); */
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","vak","exam");
pst=con.prepareStatement("select * from verbal ORDER BY dbms_random.value");
rs=pst.executeQuery();
%>
<html>
<head>
<title>VERBAL EXAM</title>
<style type="text/css">
<!--
.style7 {
font-size: 24px;
color: #330099;
font-weight: bold;
}
.style8 {
font-size: 18px;
color: #990000;
}
.style9 {font-size: 16px}
-->
</style>
<script type="text/javascript">
var c=0
var t
function abc()
{
window.location = "http://localhost:8083/onlineexam/numerical.jsp";
}
function timedCount()
{
document.getElementById('txt').value=c;
if(c==10)
abc();
c=c+1;
t=setTimeout("timedCount()",1000);
}
</script>
</head>
<body onLoad="timedCount()">
<form id="f1" name="form1" method="post" action="numerical.jsp" >
<table width="975" height="362" border="0">
<tr>
<td width="10" height="218"><table width="741" border="0">
<tr>
<td width="237" height="212"><img src="images/logo.jpg" width="237" height="210" /></td>
<td width="231"><img src="images/bannerimg.jpg" width="752" height="210" /></td>
</tr>
</table></td>
</tr>
<tr bgcolor="#FFFFCA">
<td height="138"><div align="center" class="style7">
<p> </p>
<p>Verbal Ability </p>
<p align="right"><input type="text" id="txt" style="background-color:#FFFFCA"/></p>
<p align="left"><span class="style8">Sentence Completion Instructions:</span></p>
<p align="left"><span class="style8"><span class="style9"> The following sentences are incomplete.Choose the word or phrase that most correctly completes the sentence. </span></span></p>
<p align="left"> </p>
</div>
<table border="0" width="500px" cellspacing="2" cellpadding="4">
<%
int i=1;
while(rs.next())
{
%>
<tr>
<td width="26%"> <strong>Question:<%=i%></strong>.<%=rs.getString(1) %> <input type="text" name="que<%=i%>" style="visibility:hidden" value= "<%= rs.getString(1) %>" /></td>
<tr>
<td> <strong>a:</strong>
<input type="radio" name="q<%=i%>" value= "<%= rs.getString(2)%>" />
<%= rs.getString(2) %></td>
</tr>
<tr>
<td> <strong>b:</strong>
<input type="radio" name="q<%=i%>" value="<%= rs.getString(3)%>" />
<%= rs.getString(3) %></td>
</tr>
<tr>
<td> <strong>c:</strong>
<input type="radio" name="q<%=i%>" value="<%= rs.getString(4)%>" />
<%= rs.getString(4) %></td>
</tr>
<tr>
<td> <strong>d:
</strong>
<input type="radio" name="q<%=i%>" value="<%= rs.getString(5)%>" />
<%= rs.getString(5) %> </td>
</tr>
<tr>
<td><center>
<%
i++;
}
%>
<input type="submit" value="Next" name="submit" />
</center></td>
</tr>
</table>
<p> </p></td>
</tr>
</table>
</form>
</body>
</html>
<%
rs.close();
pst.close();
con.close();
%>
The problem is wen the function abc is called i,e the timeout happens the radio checked values are not being carried from first jsp to another jsp. so any solution could help me??