Reputation: 1
I am Making a Project Online Exam Management System. There are Three Admin, Faculty and Student Admin and Faculty both Can Insert and Update and Delete Subject and Questions I want make the Servlet When Admin Add or Remove Subject or Questions Servlet Must be back Redirect to Admin Home page and When Faculty Add or Remove Subject or Questions Page Must be Redirect to Faculty Home Page
Upvotes: 0
Views: 112
Reputation: 1462
You can create a User
class with field like typeOfUser
. Then while registering user you can populate this field in your RegistrationServlet
on the basis of who is getting registered. eg: admin, student, faculty.
Now once you have typeOfUser
information captured, whenever user logs-in add typeOfUser
in the Session
eg: session.setAttribute("typeOfUser", "Admin")
.
When Faculty/Admin Add or Remove Subject or Questions, check typeOfUser
and redirect him/her to respective page. Code snippet could be like below:
String typeOfUser = (String)session.getAttribute("typeOfUser");
if(typeOfUser.equals("admin")){
response.sendRedirect("admin-home.jsp");
}else if(typeOfUser.equals("faculty")){
response.sendRedirect("faculty-home.jsp");
}
Upvotes: 1