0% found this document useful (0 votes)
39 views103 pages

Online Quiz Portal with Servlets and JSP

Uploaded by

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

Online Quiz Portal with Servlets and JSP

Uploaded by

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

Mini Project:Online Quiz Portal using Servlets,JSP ans Jdbc

Project Objective: Create an Online quiz portal, where users can explore
multiple quiz, attempt the quiz, and save their position on the learder board.
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

/**
* Servlet implementation class DashboardServletClass
*/
public class DashboardServletClass extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public DashboardServletClass() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request,
HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
QuizListservice quizService=new QuizListServiceImpl();
List<QuizListBean> TotalQuizlist=[Link]();
[Link]("TotalQuizlist", TotalQuizlist);
if(![Link]()) {
RequestDispatcher dispatcher=
[Link]("[Link]");
[Link](request, response);
}else {
RequestDispatcher dispatcher=
[Link]("[Link]");
[Link](request, response);
}

/**
* @see HttpServlet#doPost(HttpServletRequest request,
HttpServletResponse response)
*/
// protected void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
// doGet(request, response);
// }

package [Link];

import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

/**
* Servlet implementation class DeleteQuizServlet
*/
public class DeleteQuizServlet extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public DeleteQuizServlet() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request,
HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
String quizid=[Link]("quizId");
QuizList quiz=new QuizList();
quiz.setQuiz_id(quizid);
PrintWriter out=[Link]();
QuizListservice quizservice=new QuizListServiceImpl();

boolean delete;
try {
delete = [Link](quiz);
if(delete) {
RequestDispatcher
rd=[Link]("/dashboardpage");
[Link](request, response);
}
} catch (ClassNotFoundException | SQLException e) {
[Link]();
}

package [Link];

import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

/**
* Servlet implementation class GetById
*/
public class GetById extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public GetById() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request,
HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
String quizId=[Link]("quizId");
QuizList quiz=new QuizList();
quiz.setQuiz_id(quizId);
PrintWriter out=[Link]();
QuizListservice quizservice=new QuizListServiceImpl();
List<QuizListBean> TotalQuizlist;
try {
TotalQuizlist = [Link](quiz);
[Link]("TotalQuizlist", TotalQuizlist);
if(![Link]()) {
RequestDispatcher dispatcher=
[Link]("[Link]");
[Link](request, response);
}else {
RequestDispatcher dispatcher=

[Link]("[Link]");
[Link](request, response);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
[Link]();
}

}
}

package [Link];

import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];

/**
* Servlet implementation class LoginServletClass
*/
public class LoginServletClass extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public LoginServletClass() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doPost(HttpServletRequest request,
HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
String username=[Link]("username");
String password=[Link]("password");

Users users=new Users();


[Link](username);
[Link](password);
PrintWriter out=[Link]();
UsersService userService=new UserServiceImpl();
try {
boolean auth=[Link](users);
if(auth) {

//[Link]("<b> Login successfully");


HttpSession session=[Link]();
[Link](10*60);
[Link]("username", username);
RequestDispatcher
rd=[Link]("[Link]");
[Link](request, response);
}
}catch(AuthenticationException e) {
[Link]("<font color=red> Login Failed");
}
}

package [Link];

import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

/**
* Servlet implementation class QuestionListServletClass
*/
public class QuestionListServletClass extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public QuestionListServletClass() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request,
HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
Questionsservice quizService=new QuestionServiceImpl();
try {
List<QuestionListBean> TotalQuestuinlist =
[Link]();
[Link]("TotalQuizlist", TotalQuestuinlist);
if(![Link]()) {
RequestDispatcher dispatcher=
[Link]("[Link]");
[Link](request, response);
}else {
RequestDispatcher dispatcher=

[Link]("[Link]");
[Link](request, response);
}
} catch (ClassNotFoundException | SQLException e) {
// TODO Auto-generated catch block
[Link]();
}

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

package [Link];

import [Link];

import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];

/**
* Servlet implementation class SaveQuestionsServlet
*/
public class SaveQuestionsServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public SaveQuestionsServlet() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request,
HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
String question=[Link]("questions");
String op1=[Link]("option1");
String op2=[Link]("option2");
String op3=[Link]("option3");
String op4=[Link]("option4");
String crctans=[Link]("correctAnswer");
String quizId=[Link]("quizId");
String wt=[Link]("weightage");

Quizz quiz=new Quizz();


quiz.setCorrect_answer(crctans);
[Link](question);
quiz.setOption1(op1);
quiz.setOption2(op2);
quiz.setOption3(op3);
quiz.setOption4(op4);
quiz.setQuiz_id(quizId);
[Link](wt);

try {
// Call a DAO or service method to save the quiz question to the
database
QuestionsDAO quizDAO = new QuestionDAOImpl();
boolean isSaved = [Link](quiz);

if (isSaved) {
[Link]("[Link]");
} else {
[Link]("[Link]");
}
} catch (Exception e) {
[Link]();
[Link]("[Link]");
}

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

package [Link];

import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];

/**
* Servlet implementation class updateServletClass
*/
public class updateServletClass extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public updateServletClass() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see HttpServlet#doGet(HttpServletRequest request,
HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
String quizid=[Link]("quizId");
String quizName=[Link]("quizName");
String quizcatogoty=[Link]("quizCategory");
String quizmarks=[Link]("quizTotalmarks");
int marks=[Link](quizmarks);
QuizList quiz=new QuizList();
quiz.setQuiz_id(quizid);
[Link](quizName);
[Link](quizcatogoty);
[Link](marks);
QuizListservice quizservice=new QuizListServiceImpl();
try {
boolean update=false;
update=[Link](quiz);
if(update) {
RequestDispatcher
rd=[Link]("[Link]");
[Link](request, response);
}
}catch(Exception e) {
[Link]();
}
}

package [Link];

import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];

/**
* Servlet implementation class userLoginServlet
*/
public class userLoginServlet extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public userLoginServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request,
HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
String username=[Link]("username");
String password=[Link]("password");
Users users=new Users();
[Link](username);
[Link](password);
PrintWriter out=[Link]();
UsersService userService=new UserServiceImpl();
try {
boolean auth=[Link](users);
if(auth) {

//[Link]("<b> Login successfully");


HttpSession session=[Link]();
[Link](10*60);
QuizListservice quizService=new
QuizListServiceImpl();
List<QuizListBean> TotalQuizlist=[Link]();
[Link]("TotalQuizlist", TotalQuizlist);
if(![Link]()) {
RequestDispatcher dispatcher=
[Link]("[Link]");
[Link](request, response);
}else {
RequestDispatcher dispatcher=

[Link]("[Link]");
[Link](request, response);
}
}
}catch(AuthenticationException e) {
[Link]("<font color=red> Login Failed");
}
}

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

}
package [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];

public class QuestionDAOImpl implements QuestionsDAO {


ConnectionManager connectionManager=new ConnectionManager();
@Override
public boolean create(Quizz quiz) throws ClassNotFoundException,
SQLException {
boolean created = false;
Connection contn = [Link]();
PreparedStatement statement = [Link]("insert
into
quizz(quiz_id,questions,option1,option2,option3,option4,correct_answer,weig
htage) values(?,?,?,?,?,?,?,?)");
[Link](1, quiz.getQuiz_id());
[Link](2, [Link]());
[Link](3, quiz.getOption1());
[Link](4, quiz.getOption2());
[Link](5, quiz.getOption3());
[Link](6, quiz.getOption4());
[Link](7, quiz.getCorrect_answer());
[Link](8, [Link]());
int row = [Link]();
while(row > 0)
{
created = true;
}
[Link]();
return created;
}

@Override
public List<Quizz> retrive() throws ClassNotFoundException,
SQLException {
Connection connection =[Link]();
PreparedStatement
prepared=[Link]("select
[Link],q.option1,q.option2,q.option3,q.option4,q.s_no,q.correct_answer,
q.quiz_id from quizz q inner join quiz_list q1 on q.quiz_id=q1.quiz_id");
List<Quizz> question=new ArrayList<>();
Quizz q=new Quizz();
ResultSet rs=[Link]();
while([Link]()) {
[Link]([Link](1));
q.setOption1([Link](2));
q.setOption2([Link](3));
q.setOption4([Link](4));
q.setS_no([Link](5));
q.setCorrect_answer([Link](6));
q.setQuiz_id([Link](7));
[Link](q);
}
return question;
}

@Override
public boolean deleteById(Quizz quizz) throws ClassNotFoundException,
SQLException {
boolean deleteUser=false;
try {
Connection connection=[Link]();
PreparedStatement
statement=[Link]("DELETE FROM quizz WHERE s_no
= ?");
[Link](1, quizz.getS_no());
int rows=[Link]();
if(rows>0) {
deleteUser=true;
}else {
deleteUser=false;
}
}catch(Exception e) {
[Link](e);
}
return deleteUser;

@Override
public List<Quizz> getById(Quizz quizz) throws ClassNotFoundException,
SQLException {
List<Quizz> quizList = new ArrayList<>();
Connection connection=[Link]();
PreparedStatement
statemet=[Link]("SELECT * FROM quizz WHERE s_no
= ?");
[Link](1, quizz.getS_no());
ResultSet result=[Link]();
while([Link]()) {
Quizz q=new Quizz();
q.setQuiz_id([Link]("quiz_id"));
q.setS_no([Link]("s_no"));
[Link]([Link]("questions"));
q.setOption1([Link]("option1"));
q.setOption2([Link]("option2"));
q.setOption3([Link]("option3"));
q.setOption4([Link]("option4"));
q.setCorrect_answer([Link]("correct_answer"));
[Link]([Link]("weightage"));
[Link](q);
}
return quizList;
}

@Override
public boolean update(Quizz questionlist) throws
ClassNotFoundException, SQLException {
boolean updatequiz=false;
Connection connection=[Link]();
PreparedStatement
statement=[Link]("update quizz set
questions=?,option1=?,option2=?,option3=?,option4=?,correct_answer=?,quiz
_id=?,weightage=?");
[Link](1, [Link]());
[Link](2, questionlist.getOption1());
[Link](3, questionlist.getOption2());
[Link](4, questionlist.getOption3());
[Link](5, questionlist.getOption4());
[Link](6, questionlist.getCorrect_answer());
[Link](7, questionlist.getQuiz_id());
[Link](8, [Link]());
int rows=[Link]();
[Link]();
if(rows>0) {
updatequiz=true;
}else {
updatequiz= false;
}
return updatequiz;
}

package [Link];

import [Link];
import [Link];
import [Link];

public interface QuestionsDAO {

public boolean create(Quizz quizz) throws


ClassNotFoundException,SQLException;
public List<Quizz> retrive() throws
ClassNotFoundException,SQLException;
public boolean deleteById(Quizz quizz)throws
ClassNotFoundException,SQLException;
public List<Quizz> getById(Quizz quizz) throws
ClassNotFoundException,SQLException;
public boolean update(Quizz quizList) throws
ClassNotFoundException,SQLException;
}

package [Link];

import [Link];
import [Link];
import [Link];
import [Link];

public interface QuizDAO {

public boolean create(QuizList quizList) throws


ClassNotFoundException,SQLException;
public List<QuizList> retrive() throws
ClassNotFoundException,SQLException;
public boolean deleteById(QuizList quiz)throws
ClassNotFoundException,SQLException;
public List<QuizList> getById(QuizList quiz) throws
ClassNotFoundException,SQLException;
public boolean update(QuizList quizList) throws
ClassNotFoundException,SQLException;

package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];

public class QuizDAOImpl implements QuizDAO {


private ConnectionManager connectionManager=new
ConnectionManager();
@Override
public boolean create(QuizList quizList) throws ClassNotFoundException,
SQLException {
boolean userFound = false;
Connection contn = [Link]();
QuizList quiz=new QuizList();
PreparedStatement statement = [Link]("insert
into quiz_list(quiz_id,quizes,catagory,total_marks) values(?,?,?,?)");
[Link](1, quiz.getQuiz_id());
[Link](2, [Link]());
[Link](3, [Link]());
[Link](4, [Link]());
int row = [Link]();
while(row > 0)
{
userFound = true;
}
[Link]();
return userFound;
}

@Override
public List<QuizList> retrive() throws ClassNotFoundException,
SQLException {
Connection connection=[Link]();
Statement statement=[Link]();
ResultSet result=[Link]("select * from
quiz_list");
List<QuizList> quizlist=new ArrayList<>();
while([Link]()) {
QuizList quiz=new QuizList();
quiz.setQuiz_id([Link](1));
quiz.setS_no([Link](2));
[Link]([Link](3));
[Link]([Link](4));
[Link]([Link](5));
[Link](quiz);
}
[Link]();
return quizlist;
}

@Override
public boolean deleteById(QuizList quiz) throws
ClassNotFoundException, SQLException {
boolean deleteUser=false;
try {
Connection connection=[Link]();
PreparedStatement
statement=[Link]("DELETE FROM quiz_list WHERE
quiz_id = ?");
[Link](1, quiz.getQuiz_id());
int rows=[Link]();
if(rows>0) {
deleteUser=true;
}else {
deleteUser=false;
}
}catch(Exception e) {
[Link](e);
}
return deleteUser;

@Override
public List<QuizList> getById(QuizList quiz) throws
ClassNotFoundException, SQLException {
List<QuizList> quizList = new ArrayList<>();
Connection connection=[Link]();
PreparedStatement
statemet=[Link]("SELECT * FROM quiz_list WHERE
quiz_id = ?");
[Link](1, quiz.getQuiz_id());
ResultSet result=[Link]();
while([Link]()) {
QuizList q=new QuizList();
q.setQuiz_id([Link]("quiz_id"));
q.setS_no([Link]("s_no"));
[Link]([Link]("quizes"));
[Link]([Link]("catagory"));
[Link]([Link]("total_marks"));
[Link](q);
}
return quizList;
}

@Override
public boolean update(QuizList quizList) throws
ClassNotFoundException, SQLException {
boolean updatequiz=false;
Connection connection=[Link]();
PreparedStatement
statement=[Link]("update quiz_list set
quizes=?,catagory=?,total_marks=? where quiz_id=?");
[Link](1, [Link]());
[Link](2, [Link]());
[Link](3, [Link]());
[Link](4, quizList.getQuiz_id());
int rows=[Link]();
[Link]();
if(rows>0) {
updatequiz=true;
}else {
updatequiz= false;
}
return updatequiz;

package [Link];
import [Link];

import [Link];

public interface UsersDAO {

public boolean authenticate(Users users) throws


ClassNotFoundException,SQLException;
public boolean authenticateNormalUser(Users users) throws
ClassNotFoundException,SQLException;
}

package [Link];

import [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];

public class UsersDAOImpl implements UsersDAO {


private ConnectionManager connectionManager=new
ConnectionManager();
@Override
public boolean authenticate(Users users) throws
ClassNotFoundException, SQLException {
boolean userFound=false;
Connection connection=[Link]();
PreparedStatement statement=
[Link]("select * from users where (username=? and
password=? ) and role=?");
[Link](1, [Link]());
[Link](2, [Link]() );
[Link](3, "1");
ResultSet resultset=[Link]();
while([Link]()) {
userFound=true;
}
return userFound;
}
@Override
public boolean authenticateNormalUser(Users users) throws
ClassNotFoundException, SQLException {
boolean userFound=false;
Connection connection=[Link]();
PreparedStatement statement=
[Link]("select * from users where (username=? and
password=? ) and role=?");
[Link](1, [Link]());
[Link](2, [Link]() );
[Link](3, "0");
ResultSet resultset=[Link]();
while([Link]()) {
userFound=true;
}
return userFound;
}

}
package [Link];

import [Link];

public class QuizList {

private String quiz_id;


private int s_no;
private String quizes;
private String catagory;
private int totalmarks;

public QuizList() {}

public String getQuiz_id() {


return quiz_id;
}

public void setQuiz_id(String quiz_id) {


this.quiz_id = quiz_id;
}

public int getS_no() {


return s_no;
}
public void setS_no(int s_no) {
this.s_no = s_no;
}

public String getQuizes() {


return quizes;
}

public void setQuizes(String quizes) {


[Link] = quizes;
}

public String getCategories() {


return catagory;
}

public void setCategories(String catagory) {


[Link] = catagory;
}

public int getTotalmarks() {


return totalmarks;
}

public void setTotalmarks(int totalmarks) {


[Link] = totalmarks;
}

@Override
public String toString() {
return "QuizList [quiz_id=" + quiz_id + ", s_no=" + s_no + ",
quizes=" + quizes + ", categories=" + catagory
+ ", totalmarks=" + totalmarks + "]";
}

@Override
public int hashCode() {
return [Link](catagory, quiz_id, quizes, s_no, totalmarks);
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != [Link]())
return false;
QuizList other = (QuizList) obj;
return [Link](catagory, [Link]) &&
[Link](quiz_id, other.quiz_id)
&& [Link](quizes, [Link]) && s_no ==
other.s_no && totalmarks == [Link];
}

package [Link];

import [Link];

public class Quizz {


private int s_no;
private String questions;
private String option1;
private String option2;
private String option3;
private String option4;
private String correct_answer;
private String quiz_id;
private String weightage;

public String getWeightage() {


return weightage;
}

public void setWeightage(String weightage) {


[Link] = weightage;
}

public Quizz() {}

public int getS_no() {


return s_no;
}

public void setS_no(int s_no) {


this.s_no = s_no;
}

public String getQuestions() {


return questions;
}

public void setQuestions(String questions) {


[Link] = questions;
}

public String getOption1() {


return option1;
}

public void setOption1(String option1) {


this.option1 = option1;
}

public String getOption2() {


return option2;
}

public void setOption2(String option2) {


this.option2 = option2;
}

public String getOption3() {


return option3;
}

public void setOption3(String option3) {


this.option3 = option3;
}

public String getOption4() {


return option4;
}

public void setOption4(String option4) {


this.option4 = option4;
}
public String getCorrect_answer() {
return correct_answer;
}

public void setCorrect_answer(String correct_answer) {


this.correct_answer = correct_answer;
}

public String getQuiz_id() {


return quiz_id;
}

public void setQuiz_id(String quiz_id) {


this.quiz_id = quiz_id;
}

@Override
public String toString() {
return "Quizz [s_no=" + s_no + ", questions=" + questions + ",
option1=" + option1 + ", option2=" + option2
+ ", option3=" + option3 + ", option4=" + option4 + ",
correct_answer=" + correct_answer + ", quiz_id="
+ quiz_id + ", weightage=" + weightage + "]";
}
@Override
public int hashCode() {
return [Link](correct_answer, option1, option2, option3,
option4, questions, quiz_id, s_no, weightage);
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != [Link]())
return false;
Quizz other = (Quizz) obj;
return [Link](correct_answer, other.correct_answer) &&
[Link](option1, other.option1)
&& [Link](option2, other.option2) &&
[Link](option3, other.option3)
&& [Link](option4, other.option4) &&
[Link](questions, [Link])
&& [Link](quiz_id, other.quiz_id) && s_no ==
other.s_no
&& [Link](weightage, [Link]);
}
}

package [Link];

import [Link];

public class Users {

private String username;


private String password;
private String role;

public Users() {}

public String getUsername() {


return username;
}

public void setUsername(String username) {


[Link] = username;
}

public String getPassword() {


return password;
}

public void setPassword(String password) {


[Link] = password;
}

public String getRole() {


return role;
}

public void setRole(String role) {


[Link] = role;
}

@Override
public String toString() {
return "Users [username=" + username + ", password=" +
password + ", role=" + role + "]";
}

@Override
public int hashCode() {
return [Link](password, role, username);
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != [Link]())
return false;
Users other = (Users) obj;
return [Link](password, [Link]) &&
[Link](role, [Link])
&& [Link](username, [Link]);
}

package [Link];

public class AuthenticationException extends Exception {

private String message;

public AuthenticationException(String message) {


[Link]=message;
}

public String getMessage() {


return message;

package [Link];

import [Link];
import [Link];
import [Link];

public class ConnectionManager {


private Connection connection= null;
public Connection openConnection() throws ClassNotFoundException,
SQLException {
DataSource dataSource=new DataSource("db");
[Link]([Link]());

connection=[Link]([Link](),[Link]
Username(),[Link]());
return connection;
}

public void closeConnection() throws SQLException {


[Link]();
}
}

package [Link];

import [Link];

public class DataSource {


private String Driver;
private String url;
private String username;
private String password;
public DataSource(String baseName) {
ResourceBundle
resourceBundle=[Link](baseName);
[Link] = [Link]("driver");
[Link] = [Link]("url");;
[Link] = [Link]("username");
[Link] = [Link]("password");
}
public String getDriver() {
return Driver;
}
public String getUrl() {
return url;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}

}
package [Link];

import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];

public class QuestionListBean {

private String quizId;


private int sNo;
private String Questions;
private String Option1;
private String Option2;
private String Option3;
private String Option4;
private String CorrectAnswer;
private String weightage;

public QuestionListBean() {}

public String getWeightage() {


return weightage;
}

public void setWeightage(String weightage) {


[Link] = weightage;
}

public String getQuizId() {


return quizId;
}

public void setQuizId(String quizId) {


[Link] = quizId;
}

public int getsNo() {


return sNo;
}
public void setsNo(int sNo) {
[Link] = sNo;
}

public String getQuestions() {


return Questions;
}

public void setQuestions(String questions) {


Questions = questions;
}

public String getOption1() {


return Option1;
}

public void setOption1(String option1) {


Option1 = option1;
}

public String getOption2() {


return Option2;
}

public void setOption2(String option2) {


Option2 = option2;
}

public String getOption3() {


return Option3;
}

public void setOption3(String option3) {


Option3 = option3;
}

public String getOption4() {


return Option4;
}

public void setOption4(String option4) {


Option4 = option4;
}

public String getCorrectAnswer() {


return CorrectAnswer;
}

public void setCorrectAnswer(String correctAnswer) {


CorrectAnswer = correctAnswer;
}
@Override
public String toString() {
return "QuestionListBean [quizId=" + quizId + ", sNo=" + sNo + ",
Questions=" + Questions + ", Option1="
+ Option1 + ", Option2=" + Option2 + ", Option3=" +
Option3 + ", Option4=" + Option4
+ ", CorrectAnswer=" + CorrectAnswer + ",
weightage=" + weightage + ", quizservice=" + quizservice
+ "]";
}

Questionsservice quizservice=new QuestionServiceImpl();

public List<QuestionListBean> retrive() throws ClassNotFoundException,


SQLException{
return [Link]();

public boolean create(Quizz quiz) {


return false;

}
}

package [Link];

import [Link];

import [Link];
import [Link];

public class QuizListBean {


private String quizId;
private int serialNo;
private String quizNames;
private String quizCategories;
private int quizTotalmarks;

public QuizListBean() {}

public String getQuizId() {


return quizId;
}

public void setQuizId(String quizId) {


[Link] = quizId;
}
public int getSerialNo() {
return serialNo;
}

public void setSerialNo(int serialNo) {


[Link] = serialNo;
}

public String getQuizNames() {


return quizNames;
}

public void setQuizNames(String quizNames) {


[Link] = quizNames;
}

public String getQuizCategories() {


return quizCategories;
}

public void setQuizCategories(String quizCategories) {


[Link] = quizCategories;
}

public int getQuizTotalmarks() {


return quizTotalmarks;
}

public void setQuizTotalmarks(int quizTotalmarks) {


[Link] = quizTotalmarks;
}

@Override
public String toString() {
return "QuizListBean [quizId=" + quizId + ", serialNo=" + serialNo +
", quizNames=" + quizNames
+ ", quizCategories=" + quizCategories + ",
quizTotalmarks=" + quizTotalmarks + "]";
};

QuizListservice quizservice=new QuizListServiceImpl();

public List<QuizListBean> retrive(){


return [Link]();

package [Link];
import [Link];
import [Link];
import [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

public class QuestionServiceImpl implements Questionsservice{


QuestionsDAO quizDao=new QuestionDAOImpl();
@Override
public boolean create(Quizz quizz) throws ClassNotFoundException,
SQLException {
return [Link](quizz);
}

@Override
public List<QuestionListBean> retrive() throws ClassNotFoundException,
SQLException {
List<QuestionListBean> QuestionBeanList=new ArrayList<>();
try {
List<Quizz> QuestionList=[Link]();
for(Quizz quiz:QuestionList) {
QuestionListBean QuestionListBean=new
QuestionListBean();
[Link](quiz.getQuiz_id());
[Link]([Link]());
QuestionListBean.setOption1(quiz.getOption1());
QuestionListBean.setOption2(quiz.getOption2());
QuestionListBean.setOption3(quiz.getOption3());
QuestionListBean.setOption4(quiz.getOption4());
[Link](quiz.getS_no());

[Link](quiz.getCorrect_answer());
[Link](QuestionListBean);
}
} catch (ClassNotFoundException e) {
[Link]();
} catch (SQLException e) {
[Link]();
}
return QuestionBeanList;
}

@Override
public boolean deleteById(Quizz quizz) throws ClassNotFoundException,
SQLException {
return [Link](quizz);
}
@Override
public List<QuestionListBean> getById(Quizz quizz) throws
ClassNotFoundException, SQLException {
List<QuestionListBean> quizBeanList=new ArrayList<>();
try {
List<Quizz> quizList=[Link](quizz);
for(Quizz quiz1:quizList) {
QuestionListBean QuestionListBean=new
QuestionListBean();
[Link](quiz1.getQuiz_id());
[Link](quiz1.getS_no());
[Link]([Link]());
QuestionListBean.setOption1(quiz1.getOption1());
QuestionListBean.setOption2(quiz1.getOption2());
QuestionListBean.setOption3(quiz1.getOption3());
QuestionListBean.setOption4(quiz1.getOption4());

[Link](quiz1.getCorrect_answer());

[Link]([Link]());
[Link](QuestionListBean);
}
}catch(ClassNotFoundException e) {
[Link]();
}catch(SQLException e) {
[Link]();
}
return quizBeanList;
}

@Override
public boolean update(Quizz questions) throws ClassNotFoundException,
SQLException {
return [Link](questions);
}

package [Link];

import [Link];
import [Link];
import [Link];
import [Link];

public interface Questionsservice {


public boolean create(Quizz quizz) throws
ClassNotFoundException,SQLException;
public List<QuestionListBean> retrive() throws
ClassNotFoundException,SQLException;
public boolean deleteById(Quizz quizz)throws
ClassNotFoundException,SQLException;
public List<QuestionListBean> getById(Quizz quizz) throws
ClassNotFoundException,SQLException;
public boolean update(Quizz quizList) throws
ClassNotFoundException,SQLException;
}

package [Link];

import [Link];
import [Link];

import [Link];
import [Link];

public interface QuizListservice {


public List<QuizListBean> retrive();
public boolean DeleteById(QuizList quiz) throws
ClassNotFoundException,SQLException;
public List<QuizListBean> getById(QuizList quiz)throws SQLException;
public boolean update(QuizList quizList)throws ClassNotFoundException,
SQLException;

package [Link];

import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

public class QuizListServiceImpl implements QuizListservice {


QuizDAO quizDAo=new QuizDAOImpl();
@Override
public List<QuizListBean> retrive() {

List<QuizListBean> quizBeanList=new ArrayList<>();


try {
List<QuizList> quizList=[Link]();
for(QuizList quiz:quizList) {
QuizListBean quizListBean=new QuizListBean();
[Link](quiz.getQuiz_id());
[Link](quiz.getS_no());
[Link]([Link]());
[Link]([Link]());
[Link]([Link]());
[Link](quizListBean);
}
} catch (ClassNotFoundException e) {
[Link]();
} catch (SQLException e) {
[Link]();
}
return quizBeanList;
}
@Override
public boolean DeleteById(QuizList quiz) throws
ClassNotFoundException, SQLException {
return [Link](quiz);
}
@Override
public List<QuizListBean> getById(QuizList quiz) throws SQLException {
List<QuizListBean> quizBeanList=new ArrayList<>();
try {
List<QuizList> quizList=[Link](quiz);
for(QuizList quiz1:quizList) {
QuizListBean quizListBean=new QuizListBean();
[Link](quiz1.getQuiz_id());
[Link](quiz1.getS_no());
[Link]([Link]());

[Link]([Link]());

[Link]([Link]());
[Link](quizListBean);
}
}catch(ClassNotFoundException e) {
[Link]();
}catch(SQLException e) {
[Link]();
}
return quizBeanList;
}
@Override
public boolean update(QuizList quizList) throws
ClassNotFoundException, SQLException {
return [Link](quizList);
}
}

package [Link];

import [Link];

import [Link];
import [Link];
import [Link];
import [Link];

public class UserServiceImpl implements UsersService {


private UsersDAO usersDAO=new UsersDAOImpl();
@Override
public boolean authenticateUser(Users users) throws
AuthenticationException {
boolean userFound=false;
try {
userFound=[Link](users);
} catch (ClassNotFoundException | SQLException e) {
[Link]();
}
if(!userFound) {
throw new AuthenticationException("Invalid username or
password");
}
return userFound;
}
@Override
public boolean authenticatenormalUser(Users users) throws
AuthenticationException {
boolean userFound=false;
try {
userFound=[Link](users);
} catch (ClassNotFoundException | SQLException e) {
[Link]();
}
if(!userFound) {
throw new AuthenticationException("Invalid username or
password");
}
return userFound;
}
}

package [Link];

import [Link];
import [Link];

public interface UsersService {

public boolean authenticateUser(Users users) throws


AuthenticationException;

public boolean authenticatenormalUser(Users users) throws


AuthenticationException;

}
///properties
///#connectivity information for mySQL
driver=[Link]
url=jdbc:mysql://localhost:3306/UsersDB
username=root
password=Phani@06

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


pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="ISO-8859-1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create New Question</title>
<style>
/* General Styles */
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

.form-container {
background-color: #fff;
padding: 30px;
border-radius: 10px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
width: 400px;
margin-top: 20px;
}
h1 {
text-align: center;
color: #333;
margin-bottom: 20px;
}

label {
font-size: 16px;
color: #333;
margin-top: 10px;
display: block;
}

input[type="text"], select {
width: 100%;
padding: 10px;
margin-top: 5px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 5px;
}

input[type="radio"] {
margin-right: 10px;
}
.options {
margin-bottom: 15px;
}

button {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}

button:hover {
background-color: #45a049;
}

.footer {
text-align: center;
font-size: 12px;
color: #777;
margin-top: 20px;
}
</style>
</head>
<body>

<div class="form-container">
<h1>Create a New Question</h1>

<form action="savequestion" method="post">


<!-- Question Name -->
<label for="questions">Question Name</label>
<input type="text" id="questions" name="questions"
placeholder="Enter your question" required>

<!-- Options -->


<div class="options">
<label>Option 1</label>
<input type="text" name="option1" required>

<label>Option 2</label>
<input type="text" name="option2" required>

<label>Option 3</label>
<input type="text" name="option3" required>

<label>Option 4</label>
<input type="text" name="option4" required>
<label>Correct Answer</label>
<input type="text" name="correctAnswer" required>

<label>QuizID</label>
<input type="text" name="quizId" required>
</div>

<!-- Weightage -->


<label for="weightage">Weightage</label>
<input type="text" id="weightage" name="weightage"
placeholder="Enter weightage" required>

<!-- Submit Button -->


<button type="submit">Create Question</button>
</form>
</div>

</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Form</title>
<style>
/* General body styling */
body {
font-family: 'Arial', sans-serif;
background-color: #eaeff1;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

/* Container for the login form */


.login-container {
width: 360px;
padding: 30px 20px;
background-color: #ffffff;
border-radius: 10px;
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* Heading style */
.login-container h2 {
text-align: center;
color: #333;
margin-bottom: 20px;
}

/* Label style */
.login-container label {
display: block;
font-size: 14px;
color: #555;
margin-bottom: 6px;
}

/* Input field style */


.login-container input[type="text"],
.login-container input[type="password"] {
width: 100%;
padding: 12px 10px;
margin-bottom: 16px;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 14px;
box-sizing: border-box;
}

/* Submit button style */


.login-container input[type="submit"] {
width: 100%;
padding: 12px;
background-color: #28a745;
color: #fff;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
}

/* Hover effect for the button */


.login-container input[type="submit"]:hover {
background-color: #218838;
}

/* Paragraph style for sign-up link */


.login-container p {
text-align: center;
margin-top: 12px;
font-size: 14px;
}

.login-container p a {
color: #007bff;
text-decoration: none;
}
.login-container p a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="login-container">
<h2>Login</h2>
<form action="adminlogin" method="post">
<label for="username">Username</label>
<input type="text" id="username" name="username"
placeholder="Enter your username" required>

<label for="password">Password</label>
<input type="password" id="password" name="password"
placeholder="Enter your password" required>

<input type="submit" value="Login">


</form>
<p>Don't have an account? <a href="#">Sign up</a></p>
</div>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" isELIgnored="false"%>
<%@taglib uri="[Link] prefix="c" %>
<%@taglib uri="[Link] prefix="f" %>

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Dashboard Table</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f9;
margin: 0;
padding: 20px;
}

table {
width: 80%;
margin: 0 auto;
border-collapse: collapse;
background-color: #ffffff;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}
th, td {
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid #ddd;
}

th {
background-color: #4CAF50;
color: white;
}

tr:nth-child(even) {
background-color: #f2f2f2;
}

tr:hover {
background-color: #ddd;
}

.button {
padding: 6px 12px;
margin: 5px;
font-size: 14px;
color: white;
border: none;
cursor: pointer;
border-radius: 4px;
text-decoration: none;
}

.edit-button {
background-color: #4CAF50;
}

.delete-button {
background-color: #f44336;
}

.edit-button:hover {
background-color: #45a049;
}

.delete-button:hover {
background-color: #e53935;
}
</style>
</head>
<body>
<table cellspacing="2" cellpadding="2" border="2">
<thead>
<tr>
<th>Quiz Id</th>
<th>Quiz Name</th>
<th>Quiz category</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<c:forEach items="${TotalQuizlist}" var="quizlist">
<tr>
<td><c:out value="${[Link]}"/></td>
<td><c:out value="${f:toUpperCase([Link])}"/></td>
<td><c:out value="${[Link]}"/></td>
<td>
<!-- Edit and Delete buttons -->
<a href="getbyid?quizId=${[Link]}" class="button edit-
button">Edit</a>
<a href="deletequiz?quizId=${[Link]}" class="button
delete-button">Delete</a>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</body>
</html>

<%@ page language="java" contentType="text/html; charset=UTF-8"


pageEncoding="UTF-8" isELIgnored="false"%>
<%@taglib uri="[Link] prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Edit Quiz</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f9;
margin: 0;
padding: 20px;
}

.form-container {
width: 50%;
margin: 0 auto;
padding: 20px;
background-color: #ffffff;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
border-radius: 8px;
}

h2 {
text-align: center;
margin-bottom: 20px;
color: #333;
}

.form-group {
margin-bottom: 15px;
}

label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}

input[type="text"], select {
width: 100%;
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
}

.button {
display: inline-block;
padding: 10px 20px;
margin-top: 20px;
font-size: 16px;
color: white;
border: none;
cursor: pointer;
border-radius: 4px;
text-decoration: none;
background-color: #4CAF50;
}

.button:hover {
background-color: #45a049;
}

.cancel-button {
background-color: #f44336;
margin-left: 10px;
}

.cancel-button:hover {
background-color: #e53935;
}
</style>
</head>
<body>
<div class="form-container">
<h2>Edit Quiz</h2>
<!-- Accessing the first element of TotalQuizlist -->
<c:forEach items="${TotalQuizlist}" var="quiz" varStatus="status"
begin="0" end="0">
<form action="updatequiz" method="post">
<!-- Quiz ID (read-only) -->
<div class="form-group">
<label for="quizId">Quiz ID</label>
<input type="text" id="quizId" name="quizId" value="$
{[Link]}" readonly>
</div>

<!-- Quiz Name -->


<div class="form-group">
<label for="quizName">Quiz Name</label>
<input type="text" id="quizName" name="quizName" value="$
{[Link]}" required>
</div>

<!-- Quiz Category -->


<div class="form-group">
<label for="quizCategory">Quiz Category</label>
<input type="text" id="quizCategory" name="quizCategory"
value="${[Link]}" required>
</div>

<div class="form-group">
<label for="quizTotalmarks">Quiz total</label>
<input type="text" id="quizTotalmarks" name="quizTotalmarks"
value="${[Link]}" required>
</div>
<!-- Submit and Cancel buttons -->
<button type="submit" class="button">Update</button>
<a href="[Link]" class="button cancel-button">Cancel</a>
</form>
</c:forEach>
</div>
</body>
</html>

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


pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

</body>
</html>
<!DOCTYPE html>
<html lang="en" method="post">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Dashboard</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
}

.sidebar {
width: 200px;
background-color: #333;
height: 100vh;
color: white;
padding-top: 20px;
position: fixed;
transition: width 0.3s ease;
}

.sidebar a {
text-decoration: none;
color: white;
padding: 10px 15px;
display: block;
}

.sidebar a:hover {
background-color: #575757;
}

.sidebar .submenu {
display: none;
margin-left: 20px;
}

.sidebar .submenu a {
padding-left: 30px;
}

.sidebar .active .submenu {


display: block;
}

.content {
margin-left: 220px;
padding: 20px;
width: 100%;
}

h1 {
text-align: center;
}

.dashboard-links {
margin-top: 20px;
}

.dashboard-links a {
display: block;
margin: 10px 0;
}

</style>
</head>
<body>

<!-- Sidebar -->


<div class="sidebar">
<h2 style="text-align: center;">Admin Panel</h2>
<a href="dashboardpage">Dashboard</a>

<!-- Question Manager with Sub-menu -->


<div class="question-manager">
<a href="javascript:void(0);" onclick="toggleSubmenu('question-
manager-submenu')">Question Manager</a>
<div id="question-manager-submenu" class="submenu">
<a href="questionlist">Question List</a>
<a href="[Link]">Add New Question</a>
</div>
</div>

<a href="#quiz-manager">Quiz Manager</a>


<a href="#logout">Logout</a>
</div>

<!-- Content Section -->


<div class="content">
<h1>Welcome to the Admin Dashboard</h1>
</div>

<script>
// Toggle the visibility of the submenu
function toggleSubmenu(id) {
var submenu = [Link](id);
if ([Link] === "block") {
[Link] = "none";
} else {
[Link] = "block";
}
}
// Function to load content dynamically into the content div (optional)
function loadContent(page) {
// Define the URL based on the page clicked
const url = "[Link] + page;

// Use the Fetch API to make an AJAX request


fetch(url)
.then(response => [Link]())
.then(data => {
// Insert the content into the content div
[Link]('content').innerHTML = data;
})
.catch(error => {
[Link]('Error loading content:', error);
});
}
</script>

</body>
</html>

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


pageEncoding="ISO-8859-1" isELIgnored="false"%>
<%@taglib uri="[Link] prefix="c" %>
<%@taglib uri="[Link] prefix="f" %>

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Dashboard Table</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f9;
margin: 0;
padding: 20px;
}

table {
width: 80%;
margin: 0 auto;
border-collapse: collapse;
background-color: #ffffff;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}

th, td {
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid #ddd;
}

th {
background-color: #4CAF50;
color: white;
}

tr:nth-child(even) {
background-color: #f2f2f2;
}

tr:hover {
background-color: #ddd;
}

.button {
padding: 6px 12px;
margin: 5px;
font-size: 14px;
color: white;
border: none;
cursor: pointer;
border-radius: 4px;
text-decoration: none;
}

.edit-button {
background-color: #4CAF50;
}

.delete-button {
background-color: #f44336;
}

.edit-button:hover {
background-color: #45a049;
}

.delete-button:hover {
background-color: #e53935;
}
</style>
</head>
<body>
<table cellspacing="2" cellpadding="2" border="2">
<thead>
<tr>
<th>S No</th>
<th>Question</th>
<th>Option-1</th>
<th>Option-2</th>
<th>Option-3</th>
<th>Option-4</th>
<th>Correct Answer</th>
<th>Action</th>

</tr>
</thead>
<tbody>
<c:forEach items="${TotalQuizlist}" var="quizlist">
<tr>
<td><c:out value="${[Link]}"/></td>
<td><c:out value="${[Link]}"/></td>
<td><c:out value="${quizlist.Option1}"/></td>
<td><c:out value="${quizlist.Option2}"/></td>
<td><c:out value="${quizlist.Option3}"/></td>
<td><c:out value="${quizlist.Option4}"/></td>
<td><c:out value="${[Link]}"/></td>
<td>
<!-- Edit and Delete buttons -->
<a href="deletebyid?quizId=${[Link]}" class="button edit-
button">Edit</a>
<a href="deletequestion?quizId=${[Link]}" class="button
delete-button">Delete</a>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</body>
</html>

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


pageEncoding="ISO-8859-1" isELIgnored="false"%>
<%@taglib uri="[Link] prefix="c" %>
<%@taglib uri="[Link] prefix="f" %>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quiz List</title>
<style>
/* Basic reset */
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}

/* Body styling */
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}

/* Container styling */
.container {
width: 80%;
margin: 20px;
padding: 20px;
background-color: #fff;
border-radius: 10px;
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
}

/* Heading styling */
h1 {
text-align: center;
color: #333;
margin-bottom: 20px;
}

/* Table styling */
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}

th, td {
padding: 10px;
text-align: left;
border: 1px solid #ddd;
}

th {
background-color: #f9f9f9;

td {
background-color: #f9f9f9;
color: black;
}

/* Button styling */
.btn-start {
padding: 8px 15px;
background-color: red;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
text-align: center;
}

.btn-start:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div class="container">
<h1>Quiz List</h1>
<table>
<thead>
<tr>
<th>Sr No</th>
<th>Quiz Title</th>
<th>Category</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<c:forEach items="${TotalQuizlist}" var="quizlist">
<tr>
<td><c:out value="${[Link]}"/></td>
<td><c:out value="${f:toUpperCase([Link])}"/></td>
<td><c:out value="${[Link]}"/></td>
<td>
<!-- Edit and Delete buttons -->
<a href="startquiz?quizId=${[Link]}" class="btn-
start">Start</a>
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>

<script>
// JavaScript function to handle the "Start" button click
function startQuiz(quizId) {
alert('Starting quiz ' + quizId);
// You can replace this with redirection to the quiz page or logic to load the
quiz
}
</script>
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Form</title>
<style>
/* Basic reset */
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}

/* Body styling */
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}

/* Login container */
.login-container {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}

/* Login box styling */


.login-box {
background-color: #fff;
padding: 40px;
border-radius: 10px;
box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
text-align: center;
width: 300px;
}

/* User icon styling */


.user-icon img {
width: 50px;
height: 50px;
border-radius: 50%;
margin-bottom: 20px;
}

/* Heading styling */
h2 {
margin-bottom: 20px;
font-size: 24px;
color: #333;
}

/* Textbox input fields */


.textbox {
margin-bottom: 20px;
}

.textbox input {
width: 100%;
padding: 10px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 5px;
outline: none;
}

/* Button styling */
.btn {
width: 100%;
padding: 10px;
font-size: 18px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}

.btn:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div class="login-container">
<div class="login-box">
<div class="user-icon">
<img src="[Link]" alt="User Icon">
</div>
<h2>Login</h2>
<form action="userlogin" method="post">
<div class="textbox">
<input type="text" name="username" placeholder="Username"
required>
</div>
<div class="textbox">
<input type="password" name="password" placeholder="Password"
required>
</div>
<button type="submit" class="btn">Login</button>
</form>
</div>
</div>
</body>
</html>

You might also like