Online Examination System
01FE25MCA018
MCA – Java Structured Enquiry
Cover Page
Title of Activity: Online Examination System Using Java, JSP, Servlets and MySQL
Student Name: Surabhi V Mahashabde
SRN: 01FE25MCA018
Semester: II MCA
Division: A
Course: Java Programming
Activity Type: Structured Enquiry
1. Activity Title
Online Examination System Using Java, JSP, Servlets and MySQL
2. Problem Statement
The Online Examination System is a web-based application developed using Java,
JSP, Servlets, JDBC, and MySQL. The application provides an efficient platform for
conducting online examinations by replacing the traditional paper-based examination
process.
The system allows students to securely log in, attend multiple-choice examinations,
submit answers electronically, and instantly view their results. Administrators can
manage users, questions, and examination details through the backend database. The
application automatically evaluates answers, calculates marks, and generates results
with improved accuracy and reduced manual effort.
The project ensures secure user authentication, efficient database management, quick
result generation, and a user-friendly interface, making it suitable for educational
institutions conducting online assessments.
pg. 1
Online Examination System
01FE25MCA018
3. Source Code
[Link] src;
package [Link];
import [Link];
import [Link];
public class DBConnection {
private static Connection con;
public static Connection getConnection() {
try {
[Link]("[Link]");
con = [Link](
"jdbc:mysql://localhost:3306/online_exam",
"root",
"password");
} catch(Exception e) {
[Link]();
}
return con;
}
}
[Link]
@WebServlet("/LoginServlet")
public class LoginServlet extends HttpServlet {
pg. 2
Online Examination System
01FE25MCA018
protected void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
String username = [Link]("username");
String password = [Link]("password");
if([Link]("admin") && [Link]("admin")) {
[Link]("[Link]");
} else {
[Link]("[Link]");
}
}
}
[Link]
@WebServlet("/ExamServlet")
public class ExamServlet extends HttpServlet {
protected void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
RequestDispatcher rd =
[Link]("[Link]");
[Link](request,response);
}
}
pg. 3
Online Examination System
01FE25MCA018
[Link]
@WebServlet("/SubmitExamServlet")
public class SubmitExamServlet extends HttpServlet {
protected void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
int score = 0;
if([Link]("q1").equals("A"))
score++;
if([Link]("q2").equals("B"))
score++;
[Link]("score", score);
RequestDispatcher rd =
[Link]("[Link]");
[Link](request,response);
}
}
[Link]
<html>
<head>
<title>Login</title>
</head>
<body>
pg. 4
Online Examination System
01FE25MCA018
<h2>Online Examination Login</h2>
<form action="LoginServlet" method="post">
Username :
<input type="text" name="username">
Password :
<input type="password" name="password">
<input type="submit" value="Login">
</form>
</body>
</html>
[Link]
<html>
<head>
<title>Online Exam</title>
</head>
<body>
<h2>Java Online Examination</h2>
<form action="SubmitExamServlet" method="post">
Q1. Java is?
pg. 5
Online Examination System
01FE25MCA018
<input type="radio" name="q1" value="A">Programming Language
<input type="radio" name="q1" value="B">Database
<input type="submit" value="Submit">
</form>
</body>
</html>
[Link]
<html>
<head>
<title>Result</title>
</head>
<body>
<h2>Your Examination Result</h2>
Score :
${score}
</body>
</html
4. Screenshots / Output
pg. 6
Online Examination System
01FE25MCA018
1. Login Page
2. Student Dashboard / Examination Page
pg. 7
Online Examination System
01FE25MCA018
[Link] Page
pg. 8