0% found this document useful (0 votes)
5 views30 pages

Java Project

The document outlines the design of a relational database for an online examination system, including an E-R diagram and detailed table structures for students, attempts, results, questions, settings, and rules. It describes the relationships between entities, such as the many-to-one relationship between students and questions, and includes source code for various JSP pages related to student registration and administrator login. The document provides a comprehensive overview of the database schema and user interface components necessary for managing the examination process.

Uploaded by

Saba Anjum
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views30 pages

Java Project

The document outlines the design of a relational database for an online examination system, including an E-R diagram and detailed table structures for students, attempts, results, questions, settings, and rules. It describes the relationships between entities, such as the many-to-one relationship between students and questions, and includes source code for various JSP pages related to student registration and administrator login. The document provides a comprehensive overview of the database schema and user interface components necessary for managing the examination process.

Uploaded by

Saba Anjum
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

E-R diagram

Administrator

updates updates updates updates

setno pmarks

sett
Question
time nmarks

ansgiven marks

q-id ques
$stud-id
stud₋name

student attempts questionQues Rules


Question tion Question

pwd phone author


ans

$stud-id $q-id
gets

op1 op2 op3 op4


$stud-id t₋marks

Result
Question
q₋a empted q₋correct
CONVERTING E-R INTO TABLES

[Link]. Field name Data Type Description


1. STUD_ID(pk) NUMBER(8) Student identification number
2 STUD_NAME VARCHAR2(10) Name of student
3 PHONE NUMBER(10) Student’s contact number
4 PWD VARCHAR2(8) Password
STUDENT-
TABLE

[Link]. Field name Data Type Description


1. STUD_ID(pk) NUMBER(8) Student identification number
2 Q_ID(pk) NUMBER(2) Question id
3 ANSGIVEN NUMBER(1) Response
4 MARKS NUMBER(1) Marks of each question

ATTEMPT- TABLE

[Link]. Field name Data Type Description


1. STUD_ID(pk) NUMBER(4) Student identification number
2 Q_ATTEMPTED NUMBER(2) Questions attempted
3 Q_CORRECT NUMBER(3) Correct responses
4 T_MARKS NUMBER(3) Total marks

RESULT- TABLE

SETT- TABLE
[Link]. Field name Data Type Description
1. TIME NUMBER(2) Time duration
2 NMARKS NUMBER(2) Negative Marks
3 PMARKS NUMBER(2) Positive Marks

QUESTION- TABLE

[Link]. Field name Data Type Description


1 Q_ID NUMBER(2) Question id
2 QUES VARCHAR2(100) Question
3 ANS NUMBER(1) Correct answer of question
4 AUTHOR VARCHAR2(20) Author
5 OP1 VARCHAR2(40) Option 1
6 OP2 VARCHAR2(40) Option2
7 OP3 VARCHAR2(40) Option3
8 OP4 VARCHAR2(40) Option4
RELATIONAL DATABASE DESIGN

The database consists of following tables:

 Student table
 Attempt table
 result table
 question table
 setting table
 rules

 Administrator updates student table where primary key is stud_id its other
attributes like password , name, phone are dependent on it. ‘Attempt‘ is a
many to one relationship between entities student and question .
 ‘Attempt’ contains composite primary keys (stud_id,q_id).its attributes are
dependent on this composite primary key,stud_id,q_id act as foreign key for
both student table and question table.
 Question table contains q_id as its primary key which uniquely defines the
entire question table.
 ‘Gets’ relationship connects student and result entities where primary key is
stud_id.
 Administrator updates setting table which contains positive marks, negative
marks, time limit, total marks.
 Administrator also updates rules or instructions.
SOURCE CODE
PAGE:[Link]
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"[Link]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>AIT EXAM</title>
</head>
<body background="[Link]">

<center>
<table cellpadding=8 cellspacing=8 border="10" bgcolor="transparent">
<th bgcolor="transparent" colspan=2>
<IMG style="WIDTH: 120px; HEIGHT: 90px" height=90 src="[Link]" width=115 > <BR>
<font face="Times New Roman" color=white size=15 >ARMY INSTITUTE OF
TECHNOLOGY</FONT><BR></th>

<tr bgcolor="transparent">
<td valign=top>
<font size=5 face="Times New Roman" color=LIGHTYELLOW>
DEPARTMENT OF INFORMATION TECHNOLOGY<BR><BR></font>
<font face="Times New Roman" color=LIGHTYELLOW size=5>
<MARQUEE direction=left WIDTH=100% BEHAVIOR=SCROLL BGColor=TRANSPARENT >ONLINE
EXAMINATION</MARQUEE><BR><BR>
<input type="button" value=" STUDENT LOGIN "
onclick="[Link]='[Link]'" ><br><BR>
<input type="button" value="ADMINISTRATOR LOGIN"
onclick="[Link]='[Link]'"><br><BR>
<input type="button" value=" CLOSE "
onclick="[Link]()"><br><BR>
</font>
</tr>

</body>
</html>

PAGE:[Link]
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"[Link]
<html>
<head>
<SCRIPT type="text/javascript">

[Link]();
function noBack() { [Link](); }
</SCRIPT>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body background="[Link]" onLoad=[Link]()>
<form name="f1" method="post" action="[Link]">
<CENTER>
<BR><BR><BR><BR><BR>
<table cellpadding=8 cellspacing=8 border="10" bgcolor="transparent">
<th bgcolor="transparent" colspan=2>
<font face="Times New Roman" color=LIGHTgrey size=5 >ADMINISTRATOR
LOGIN</FONT><BR></th>

<tr bgcolor="transparent">
<td valign=top align=left>
<font size=5 face="Times New Roman" color=LIGHTYELLOW>

<b> USER_ID </b>


</font>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="t1" size=20
maxlength=20></td>
</tr>

<tr bgcolor="transparent">
<td valign=top align=left>
<font size=5 face="Times New Roman" color=LIGHTYELLOW>
<b>PASSWORD</b>
</font>
<input type="password" name="t2" size=20 maxlength=20></td>
</tr>
<tr bgcolor="transparent">
<td valign=top >
<input type="submit" name="b1" value=" LOGIN ">
<input type="button" value=" EXIT " onclick="[Link]='[Link]'">
</tr>
</TABLE>
</CENTER>
</form>

<%
int flag=0;
String user=[Link]("t1");
String pass=[Link]("t2");
if(user!=" " && pass!=" ")
{
try{
if(([Link]("user")) && ([Link]("pass")))
[Link]("[Link]");
else
{ %>
<script language="javascript">
alert ("Invalid ID/Password");

</script>

<%
}}catch(Exception e){}

%>
</body>
</html>

PAGE:[Link]
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" import="[Link].*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"[Link]

<html>
<body background="[Link]">
<%!public int flag=0;%>
<form action="[Link]" name="f1" method=post>
<center>
<table cellpadding=8 cellspacing=8 border="10" bgcolor="transparent">
<BR><BR><BR><BR>
<th bgcolor="transparent" colspan=2>
<font size=10 face="Times New Roman" color=LIGHTgrey>STUDENT REGISTRATION </font>
<br>
</th>

<tr bgcolor="transparent">
<td valign=top align=left>
<font size=5 face="Times New Roman" color=LIGHTYELLOW>
<b>STUDENT_ID</b>
</font>
&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="t2" value="" size=20
maxlength=20></td>
<td valign=top align=left> <font size=5 face="Times New Roman"
color=LIGHTYELLOW><b>NAME</b>
</font>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;<input type="text" name="t1" value="" id="txt1" size=20 maxlength=20></td>

</tr>

<tr bgcolor="transparent">
<td valign=top align=left>
<font size=5 face="Times New Roman" color=LIGHTYELLOW>
<b>CONTACT NO.</b>
</font>
<input type="text" name="t3" value="" size=20 maxlength=10></td>
<td valign=top align=left>
<font size=5 face="Times New Roman" color=LIGHTYELLOW>
<b>PASSWORD</b>
</font>
<input type="text" name="t4" value="" size=20 maxlength=20></td>

<tr bgcolor="transparent">
<td align=center colspan=2>
<input type="SUBMIT" value="SUBMIT" name="submit" >
<input type="submit" value="SEARCH" name="submit">
<input type="SUBMIT" value="DELETE"name="submit" >
<input type="SUBMIT" value="UPDATE"name="submit">
<%
String s=[Link]("submit");
String name=[Link]("t1");
String id=[Link]("t2");
String phone=[Link]("t3");
String pwd=[Link]("t4");

try{

if([Link]("SUBMIT"))
{
if(id!="" && name!="" && phone!="" && pwd!= "")
{
[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc",
"scott", "anil");
Statement st=[Link]();
String sql="insert into student
values("+id+",'"+name+"',"+phone+",'"+pwd+"')";
[Link](sql);
%>
<script language=javascript>
alert("Inserted Sucessfully");
</script>
<%
}
else
{
%>
<script language=javascript>
alert("Enter All Entries");
</script>
<%
}
}
}
catch(Exception e1)
{

if(!(id==" "))
{

try{
if([Link]("DELETE"))
{%>
<script language="javascript">

var b=confirm ("Do You Confirm ");


if(b==1)
{
<%

[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc", "scott",
"anil");
Statement st=[Link]();
String query="delete from student where stud_id="+id;
[Link](query);
%>
alert("Deleted");
}
</script>
<%
}
}
catch(Exception e1)
{
}
}

if(!(id==" "))
{

try{
if([Link]("SEARCH"))
{[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc", "scott", "anil");
Statement st=[Link]();
ResultSet rs=[Link]("select * from student where stud_id="+id);
if([Link]())
{
%>
<script language="javascript">
alert("search found");
[Link]="<%=[Link](1)%>";
[Link]="<%=[Link](2)%>";
[Link]="<%=[Link](3)%>";
[Link]="<%=[Link](4)%>";

</script>
<%
}
else
{
%>
<script language="javascript">
alert("Record not found");
</script>
<%
}
}
}
catch(Exception e1)
{
}
}

if(!(name==" " && id==" " && phone==" " && pwd== " "))
{

try{
if([Link]("UPDATE"))
{

[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc", "scott", "anil");
Statement st=[Link]();
String query="update student set
stud_id="+id+",stud_name='"+name+"',phone="+phone+",pwd='"+pwd+"'where stud_id="+id;
[Link](query);
%>
<script language=javascript>
alert("Updated Sucessfully");
</script>
<%
}
}catch(Exception e1)
{
}
}
%>

<input type="button" value=" EXIT " onclick="[Link]='[Link]'">

</tr>

</table>
</center>
</form>
</body>
</html>

PAGE:[Link]
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"import="[Link].*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"[Link]
<html>
<head>
<%!public int i=1;%>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>

<body background="[Link]">
<form action="[Link]" name="f1" method=post>
<center>
<table cellpadding=8 cellspacing=8 border="10" bgcolor="transparent">
<BR><BR><BR><BR>
<th bgcolor="transparent" colspan=2>
<font size=10 face="Times New Roman" color=LIGHTgrey>QUESTION BANK</font>
<br>
</th>

<tr bgcolor="transparent">
<td valign=top>
<font size=5 face="Times New Roman" color=LIGHTYELLOW>
<b>[Link].</b>
</font>
<input type="text" name="t1" value="" id="txt1" size=3 maxlength=3></td>
<td valign=top>
<font size=5 face="Times New Roman" color=LIGHTYELLOW>
<b>AUTHOR</b>
</font>
<input type="text" name="t2" value="" size=30 maxlength=30></td>
</tr>

<tr bgcolor="transparent">
<td align=center colspan=2>
<font size=5 face="Times New Roman" color=LIGHTYELLOW>
<b>QUESTION</b>
</font>
<br><TEXTAREA name="t3" rows=5 cols=100 Wrap=true> </TEXTAREA></td>
</tr>
<tr bgcolor="transparent">
<td align=center colspan=2>
<input type='radio' name='o1' value=1>1
<input type="text" name="t4" value="" size=40 maxlength=40><br>
<input type='radio' name='o1'value=2>2
<input type="text" name="t5" value="" size=40 maxlength=40><br>
<input type='radio' name='o1'value=3>3
<input type="text" name="t6" value="" size=40 maxlength=40><br>
<input type='radio' name='o1'value=4>4
<input type="text" name="t7" value="" size=40 maxlength=40>
</td>
</tr>

<tr bgcolor="transparent">
<td align=center colspan=2>
<input type="SUBMIT" value="SUBMIT" name="submit" >
<input type="submit" value="SEARCH" name="submit">
<input type="SUBMIT" value="DELETE"name="submit" >
<input type="SUBMIT" value="UPDATE"name="submit">
<%
String s=[Link]("submit");

String qid=[Link]("t1");
String author=[Link]("t2");
String quest=[Link]("t3");
String op1=[Link]("t4");
String op2=[Link]("t5");
String op3=[Link]("t6");
String op4=[Link]("t7");
String ans=[Link]("o1");

//int ans2=[Link](ans);
try{

if([Link]("SUBMIT"))
{
if(qid!=null && author!=null && quest!=null && op1!=null && op2!=null &&
op3!=null && op4!=null && ans!=null)
{
//int qid2=[Link](qid);
[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc",
"scott", "anil");
Statement
st=[Link](ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
String query1="insert into question
values("+qid+",'"+quest+"',"+ans+",'"+author+"','"+op1+"','"+op2+"','"+op3+"','"+op4+"'
)";
[Link](query1);
%>
<script language=javascript>
alert("Inserted Sucessfully");
</script>
<%

}
else
{
%>
<script language=javascript>
alert("Enter all entries");
</script>
<%
}
}
}catch(Exception e1)
{[Link](e1);}

if(!( qid==" " ))


{

try{
if([Link]("SEARCH"))
{
[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc", "scott", "anil");
Statement st=[Link]();
ResultSet rs=[Link]("select * from question where q_id="+qid);
if([Link]())
{

%>
<script language="javascript">
alert("search found");
[Link]="<%=[Link](1)%>";
[Link]="<%=[Link](2)%>";
[Link]="<%=[Link](4)%>";
[Link]="<%=[Link](5)%>";
[Link]="<%=[Link](6)%>";
[Link]="<%=[Link](7)%>";
[Link]="<%=[Link](8)%>";
</script>
<%
}
else
{
%>
<script language="javascript">
alert("Record not found");
</script>
<%
}
}
}catch(Exception e1)
{
}
}

if(!(qid==" " && author==" " && quest==" " && op1== " "&& op2== " "&& op3== " "&&
op4== " "&& ans== " "))
{

try{
if([Link]("UPDATE"))
{

[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc", "scott", "anil");
Statement st=[Link]();
String query="update question set
q_id="+qid+",ques='"+quest+"',ans="+ans+",author='"+author+"',op1='"+op1+"',op2='"+op2+
"',op3='"+op3+"',op4='"+op4+"'where q_id="+qid;
[Link](query);
%>
<script language=javascript>
alert("Updated Sucessfully");
</script>
<%
}
}catch(Exception e1)
{
}
}

if(!(qid==" "))
{

try{
if([Link]("DELETE"))
{
%>
<script language="javascript">

var b=confirm ("Do You Confirm ");


if(b==1)
{
<%
[Link]("[Link]");
Connection
con=[Link]("jdbc:odbc:abc", "scott", "anil");
Statement st=[Link]();
String query="delete from question where
q_id="+qid;
[Link](query);
%>
alert("Deleted");
}
</script>
<%
}
}catch(Exception e1)
{
}
}

%>

<input type="button" value=" EXIT " onclick="[Link]='[Link]'">

</td>
</tr>

</table>
</center>
</form>
</body>
</html>

PAGE:[Link]
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" import="[Link].*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"[Link]
<html>
<SCRIPT type="text/javascript">
[Link]();
function noBack() { [Link](); }
</SCRIPT>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body background="[Link]">
<form action="[Link]" name="f1" method=post>
<br><br><br><br>
<center>
<table cellpadding=8 cellspacing=8 border="10" bgcolor="transparent">
<th bgcolor="transparent" colspan=2>
<font face="Times New Roman" color=LIGHTGREY size=5>ADMINISTRATOR</FONT><BR></th>

<tr bgcolor="transparent">
<td valign=top >
<input type="button" value="STUDENT INFO"
onclick="[Link]='[Link]'" ><br><BR>
<input type="button" value=" QUESTIONS "
onclick="[Link]='[Link]'"><br><BR>
<input type="button" value="INSTRUCTIONS" onclick="[Link]='.jsp'" ><br><BR>
<input type="button" value=" SETTINGS " onclick="[Link]='[Link]'"
><br><BR>
<input type="SUBMIT" value="RESET RECORD" name="submit" ><br><BR>
<input type="button" value=" LOGOUT " onclick="[Link]='[Link]' "
>
<%
String s=[Link]("submit");
try{
if([Link]("RESET RECORD"))
{%>
<script language="javascript">

var b=confirm ("Do You Confirm ");


if(b==1)
{
<%

[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc", "scott",
"anil");
Statement st=[Link]();
String query="delete from result ";
[Link](query);
%>
alert("Deleted");
}
</script>
<%
}
}
catch(Exception e1)
{
}
%>
</td>
</tr>
</table>
</center>
</form>
</body>
</html>

PAGE:ins_update.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1" import="[Link].*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"[Link]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body background="[Link]">
<form action="ins_update.jsp" name="f1" method=post>
<center>
<table cellpadding=8 cellspacing=8 border="10" bgcolor="transparent"
style="position:absolute;left:30px;top:25px" width=500 height=400>

<th bgcolor="transparent" colspan=2>


<font size=10 face="Times New Roman" color=LIGHTgrey>INSTRUCTIONS</font>
<br>
</th>

<tr bgcolor="transparent">
<td valign=top ALIGN="LEFT">
<font size=5 face="Times New Roman" color=LIGHTYELLOW>
<b>SR. NO.</b>
</font>
<input type="text" name="t1" value="" id="txt1" size=3 maxlength=3><BR><BR><BR>.

<font size=5 face="Times New Roman" color=LIGHTYELLOW>


<b>INSTRUCTION</b>
</font>
<br><TEXTAREA name="t2" rows=5 cols=60 Wrap=true> </TEXTAREA></td>
</tr>

<tr bgcolor="transparent">
<td align=center colspan=2>
<input type="SUBMIT" value="SUBMIT" name="submit" >
<input type="SUBMIT" value="DELETE"name="submit" >
<input type="SUBMIT" value="UPDATE"name="submit">
<%
String s=[Link]("submit");

String id=[Link]("t1");
String inst=[Link]("t2");

//int ans2=[Link](ans);
try{

if([Link]("SUBMIT"))
{
if(id!=null && inst!=null )
{
//int qid2=[Link](qid);
[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc",
"scott", "anil");
Statement
st=[Link](ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
String query1="insert into rule values('"+inst+"',"+id+")";
[Link](query1);
%>
<script language=javascript>
alert("Inserted Sucessfully");
</script>
<%

}
else
{
%>
<script language=javascript>
alert("Enter All Enteries");
</script>
<%
}

}
}catch(Exception e1)
{}

if(!( id==" " ))


{

try{
if([Link]("SEARCH"))
{
[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc", "scott", "anil");
Statement st=[Link]();
ResultSet rs=[Link]("select * from rule where ins_id="+id);
if([Link]())
{

%>
<script language="javascript">
alert("search found");
[Link]=<%=[Link](2)%>;
[Link]=<%=[Link](1)%>;

</script>
<%
}
else
{
%>
<script language="javascript">
alert("Record not found");
</script>
<%
}
}
}catch(Exception e1)
{
}
}

if(!(id==" " && inst== " "))


{

try{
if([Link]("UPDATE"))
{

[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc", "scott", "anil");
Statement st=[Link]();
String query="update rule set ins_id="+id+",inst='"+inst+"'where ins_id="+id;
[Link](query);
%>
<script language=javascript>
alert("Updated Sucessfully");
</script>
<%
}
}catch(Exception e1)
{
}
}

if(!(id==" "))
{

try{
if([Link]("DELETE"))
{
%>
<script language="javascript">

var b=confirm ("Do You Confirm ");


if(b==1)
{
<%
[Link]("[Link]");
Connection
con=[Link]("jdbc:odbc:abc", "scott", "anil");
Statement st=[Link]();
String query="delete from rule where ins_id="+id;
[Link](query);
%>
alert("Deleted");
}
</script>
<%
}
}catch(Exception e1)
{
}
}

%>

<input type="button" value=" EXIT " onclick="[Link]='[Link]'">

</td>
</tr>

</table>
</center>
<font face="Times New Roman" color=LIGHTYELLOW size=5 >
<TABLE border=10 style="position:absolute;left:660px;top:25px " width=600>
<%Object s3=[Link]("name"); %>

<%

try{

[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc", "scott", "anil");
Statement st=[Link]();
ResultSet rs=[Link]("select * from rule order by ins_id");
while([Link]())
{
%>
<tr>
<%
[Link]("<td>"+[Link](2));
[Link]( "<td>"+[Link] (1));
%>
</tr>
<%
}
}catch(Exception e1)
{}

%>

</TABLE>
</font>

</form>
</body>
</html>
PAGE:ins_update.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" import="[Link].*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"[Link]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body background="[Link]">
<form action="[Link]" method=post>
<center>
<table cellpadding=8 cellspacing=8 border="10" bgcolor="transparent">
<BR><BR><BR><BR>
<th bgcolor="transparent" colspan=2>
<font size=10 face="Times New Roman" color=LIGHTgrey>SETTINGS </font>
<br>
</th>

<tr bgcolor="transparent">
<td valign=top align=left>
<font size=5 face="Times New Roman" color=LIGHTYELLOW>
<b>TIME DURATION</b>
</font>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="t1" value="" id="txt1"
size=20 maxlength=20></td></tr>
<TR><td valign=top align=left>
<font size=5 face="Times New Roman" color=LIGHTYELLOW>
<b>POSITIVE MARKS</b>
</font>
&nbsp;&nbsp;&nbsp;<input type="text" name="t2" value="" size=20 maxlength=20></td>
</tr>

<tr bgcolor="transparent">
<td valign=top align=left>
<font size=5 face="Times New Roman" color=LIGHTYELLOW>
<b>NEGATIVE MARKS</b>
</font>
<input type="text" name="t3" value="" size=20 maxlength=10></td>

<tr bgcolor="transparent">
<td align=center colspan=2>
<input type="SUBMIT" value="SUBMIT">

<%
String td=[Link]("t1");
String pm=[Link]("t2");
String nm=[Link]("t3");

if(!(td==" " && pm==" " && nm==" "))


{

try{
int x1=[Link](td);
int x2=[Link](pm);
int x3=[Link](nm);

[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc", "scott", "anil");
Statement st=[Link]();

[Link]("update sett set time="+x1+",pmarks="+x2+",nmarks="+x3+"where setno


= 1");
%>
<script language=javascript>
alert("Updated successfully!!");
</script>
<%

}catch(Exception e1)
{

}
}
%>

<input type="button" value=" EXIT " onclick="[Link]='[Link]'">

</tr>

</table>
</center>
</form>
</body>

</html>

PAGE:[Link]

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1" import="[Link].*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"[Link]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body background="[Link]">
<form action="[Link]" method=post>
<center>
<table cellpadding=8 cellspacing=8 border="10" bgcolor="transparent">
<BR><BR><BR><BR>
<th bgcolor="transparent" colspan=2>
<font size=10 face="Times New Roman" color=LIGHTgrey>SETTINGS </font>
<br>
</th>

<tr bgcolor="transparent">
<td valign=top align=left>
<font size=5 face="Times New Roman" color=LIGHTYELLOW>
<b>TIME DURATION</b>
</font>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="t1" value="" id="txt1"
size=20 maxlength=20></td></tr>
<TR><td valign=top align=left>
<font size=5 face="Times New Roman" color=LIGHTYELLOW>
<b>POSITIVE MARKS</b>
</font>
&nbsp;&nbsp;&nbsp;<input type="text" name="t2" value="" size=20 maxlength=20></td>
</tr>

<tr bgcolor="transparent">
<td valign=top align=left>
<font size=5 face="Times New Roman" color=LIGHTYELLOW>
<b>NEGATIVE MARKS</b>
</font>
<input type="text" name="t3" value="" size=20 maxlength=10></td>

<tr bgcolor="transparent">
<td align=center colspan=2>
<input type="SUBMIT" value="SUBMIT">

<%
String td=[Link]("t1");
String pm=[Link]("t2");
String nm=[Link]("t3");

if(!(td==" " && pm==" " && nm==" "))


{

try{
int x1=[Link](td);
int x2=[Link](pm);
int x3=[Link](nm);

[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc", "scott", "anil");
Statement st=[Link]();

[Link]("update sett set time="+x1+",pmarks="+x2+",nmarks="+x3+"where setno


= 1");

%>
<script language=javascript>
alert("Updated successfully!!");
</script>
<%

}catch(Exception e1)
{

}
}
%>

<input type="button" value=" EXIT " onclick="[Link]='[Link]'">

</tr>

</table>
</center>
</form>
</body>

</html>

PAGE:[Link]

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"[Link]
<%@ page language ="java" import="[Link].*" %>
<html>
<SCRIPT type="text/javascript">
[Link]();
function noBack() { [Link](); }
</SCRIPT>
<body background="[Link]" onLoad=[Link]()>
<form name="f1" method="post">
<CENTER>
<BR><BR><BR><BR><BR>
<table cellpadding=8 cellspacing=8 border="10" bgcolor="transparent">
<th bgcolor="transparent" colspan=2>
<font face="Times New Roman" color=LIGHTgrey size=5 ><B>STUDENT
LOGIN</B></FONT><BR></th>
<tr bgcolor="transparent">
<td valign=top align =left>
<font size=5 face="Times New Roman" color=LIGHTYELLOW>
USER_ID
</font>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="t1" value=""
size=20 maxlength=20></td>
</tr>

<tr bgcolor="transparent">
<td valign=top align =left>
<font size=5 face="Times New Roman" color=LIGHTYELLOW>
PASSWORD
</font>
<input type="password" name="t2" value="" size=20 maxlength=20></td>
</tr>

<tr bgcolor="transparent">
<td valign=top>
<input type="submit" name="b1" value="LOGIN">
<input type="button" value="EXIT" onclick="[Link]='[Link]'">
</tr>

</TABLE>
</CENTER>

<%
String user=[Link]("t1");
String pass=[Link]("t2");
if(user!=" " && pass!=" ")
{
try{
[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc", "scott", "anil");
Statement st=[Link]();

ResultSet rs=[Link]("select * from student");


while([Link]())
{
String username=[Link](1);
int stud_id=[Link](username);
String password=[Link](4);
String name=[Link](2);
if([Link](username) && [Link](password))
{
ResultSet rs1=[Link]("select * from result where
stud_id="+stud_id);
if(![Link]())
{
[Link]("user",user);
[Link]("name",name);

%>
<jsp:forward page="[Link]" />
<input type=hidden name=user value=<%= username %>>

<% }
else
{
%>
<script language="javascript">
alert ("ID ALREADY ENTERED");

</script>

<%

}
}

}
%>
<script language="javascript">
alert ("Invalid ID/Password");

</script>

<%

}catch(Exception e1)
{

}
}
%>

</body>
</html>

PAGE:[Link]

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"


pageEncoding="ISO-8859-1" import="[Link].*" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"


"[Link]
<html>
<%String t=[Link]("t");int t1=[Link](t);%>
<script language="JavaScript">
var flag;
var secs;

function cd() {
mins = min; // change minutes here
secs = 0 + s(":01"); // change seconds here (always add an additional second to
your total)
redo();
}

function m(obj) {
for(var i = 0; i < [Link]; i++) {
if([Link](i, i + 1) == ":")
break;
}
return([Link](0, i));
}
function s(obj) {
for(var i = 0; i < [Link]; i++) {
if([Link](i, i + 1) == ":")
break;
}
return([Link](i + 1, [Link]));
}

function dis(mins,secs) {
var disp;
if(mins <= 9) {
disp = " 0";
} else {
disp = " ";
}
disp += mins + ":";
if(secs <= 9) {
disp += "0" + secs;
} else {
disp += secs;
}
return(disp);
}

function redo() {
secs--;
if(secs == -1) {
secs = 59;
mins--;
}
[Link] = dis(mins,secs); // setup additional displays here.
if((mins == 0) && (secs == 0)) {
[Link]("Time is up. Press OK to continue."); // change timeout
message as required
[Link] = "[Link]"
} else {
cd = setTimeout("redo()",1000);
}
}

function init() {

cd();

}
[Link] = init;
</script>
<SCRIPT type="text/javascript">
[Link]();
function noBack() { [Link](); }

function fun1()
{
//alert("previous");
[Link]="exam2?t=<%= t1%>&x=2";
[Link]();
}

function fun2()
{
//alert("submit");
[Link]();
}

function fun3()
{
// alert("next");
[Link]="exam2?t=<%= t1%>&x=3";
[Link]();
}

</SCRIPT>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<%!public int i=1,qid=0,mark=0,x1=0,x2=0,min1=40;String s2=null;boolean flag=false;%>

</head>
<body background="[Link]">
<script language="JavaScript">
var min=19;
</script>

<form name="cd">
<input id="txt" bgcolor="transparent" readonly="true" type="text" value="10:00"
border="0" name="disp">

</form>

<form name="exam1" action="exam2?t=<%= t1 %>&x=1" method=post>


<center>
<font face="Times New Roman" color=LIGHTgrey size=5 >
<table cellpadding=8 cellspacing=8 border="10" bgcolor="transparent">
<BR><BR>

<%
try{

[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc", "scott", "anil");
Statement st=[Link](ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet rs=[Link]("select * from question where q_id="+t1);
[Link]();
s2=[Link](3);
qid=[Link]([Link](1));
Object s3= [Link]("user");

[Link]( "<tr> <td align=center > <b> AUTHOR</b> :-"


+ [Link](4) +"<td><B>TIME LEFT </B>:-<input id='txt' bgcolor=transparent
readonly=true type=text value=10:00 border=0 name=disp></TR>");
[Link]( "<tr><td align=left colspan=2>"+[Link](1)
+"&nbsp;&nbsp;&nbsp;" + [Link](2)+"</tr>");
[Link]("<tr><td align=left colspan=2> <input type='radio' name='o1' value=1>
1." + [Link](5)+"<br><input type='radio' name='o1' value=2> 2." +
[Link](6)+"<br><input type='radio' name='o1' value=3> 3." +
[Link](7)+"<br><input type='radio' name='o1' value=4> 4." +
[Link](8)+"</tr>" );

%>
<input type=hidden name=q_id value=<%= qid %>>
<input type=hidden name=ans value=<%= s2 %>>
<input type=hidden name=user value=<%= s3 %>>

<%
}catch(Exception e){}

%>
<tr bgcolor="transparent">
<td align=center colspan=2><input type=button value=" PREVIOUS " onclick=fun1()>
<input type=button value=" SUBMIT " onclick=fun2()>
<input type=button value=" NEXT " onclick=fun3()>
<input type=button value=" EXIT "
onclick="[Link]='[Link]'">

</table>
</font>
</center>
</form>
</body>
</html>

PAGE:[Link]
import [Link];
import [Link].*;
import [Link];
import [Link];
import [Link].*;
import [Link];
import [Link].*;
import [Link].*;
/**
* Servlet implementation class for Servlet: exam2
*
*/
public class exam2 extends [Link] implements
[Link] {
static final long serialVersionUID = 1L;

/* (non-Java-doc)
* @see [Link]#HttpServlet()
*/
public exam2() {
super();
}

/* (non-Java-doc)
* @see [Link]#doGet(HttpServletRequest request,
HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
doPost(request,response);
}

/* (non-Java-doc)
* @see [Link]#doPost(HttpServletRequest request,
HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
String x=[Link]("x");
String t=[Link]("t");
int t1=[Link](t);
if([Link]("2"))
{
t1--;
RequestDispatcher view =
[Link]("[Link]?t="+t1);
[Link](request, response);
}
else if([Link]("3"))
{
t1++;
RequestDispatcher view =
[Link]("[Link]?t="+t1);
[Link](request, response);
}
else
{
try
{
String s2=[Link]("ans");
String s1=[Link]("o1");
String qid=[Link]("q_id");
String s3=[Link]("user");
[Link]().print(s3);
int q_id=[Link](qid);

[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc", "scott",
"anil");
Statement st=[Link]();
ResultSet rs2=[Link]("select stud_id from attempt where
q_id="+q_id);
if(![Link]())
{
ResultSet rs1=[Link]("select * from sett");
[Link]();
int x1=[Link]([Link](4));
int x2=[Link]([Link](3));

if(s1!=null)
{
int ans1 = [Link](s1);
if([Link](s1))
{

[Link]("insert into attempt


values("+s3+","+q_id+","+ans1+","+x1+")");
}
else
{

[Link]("insert into attempt


values("+s3+","+q_id+","+ans1+","+-x2+")");
}
}
t1++;
RequestDispatcher view =
[Link]("[Link]?t="+t1);
[Link](request, response);

}
else
{
/* PrintWriter pw = [Link]();
[Link]("text/html");
[Link]("<html><head>"+
"<script language=\"text/javascript\">"+
"alert (\" already submitted\")"+
"</script></head></html>"); */

RequestDispatcher view =
[Link]("[Link]?t="+t1);
[Link](request, response);

}
}
catch(Exception e)
{
[Link]().print(e);
}
}
}
}

PAGE:[Link]
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"import="[Link].*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"[Link]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

<body background="[Link]">
<font face="Times New Roman" color=LIGHTYELLOW size=5 >

<CENTER>
<table cellpadding=8 cellspacing=8 border="10" bgcolor="transparent">
<BR><BR><BR><BR>
<th bgcolor="transparent" colspan=2>
<font face="Times New Roman" color=LIGHTGREY size=7>
RESULT<BR></font></th>
<%
try{
int i=0,marks=0,ta=0,flag=0;
Object s3=[Link]("user");
[Link]("[Link]");
Connection con=[Link]("jdbc:odbc:abc", "scott", "anil");
Statement st=[Link](ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet rs1=[Link]("select * from sett");
[Link]();
String x=[Link](4);
ResultSet rs=[Link]("select * from attempt");
while([Link]())
{
ta=ta+1;
if([Link]([Link](4)))
{
i=i+1;
}
marks=marks+[Link]([Link](4));
}
[Link]("insert into result values("+s3+","+ta+","+i+","+marks+")");
[Link]("<tr><td>NUMBER OF QUESTIONS ATTEMPTED:<td><B>"+ta+"</B></tr>");
[Link]("<tr><td>NUMBER OF CORRECT ANSWERS :<td><B>"+i+"</B></tr>");
[Link]("<tr><td>TOTAL MARKS OBTAINED :<td><B>"+marks+"</B></tr>");
[Link]("delete from attempt");
}catch(Exception e1)
{}%>

<tr bgcolor="transparent">
<td align=center colspan=2><input type="button" value=" CLOSE "
onclick="[Link]()"></tr>
</table>
</CENTER>
</font>
</body>
</html>

SNAPSHOTS:

You might also like