基于JavaWeb开发的学生成绩,使用MyEclipse2014开发,连接MySQL数据库,存储学生的身份信息、成绩,管理员的身份信息,课程信息。
功能说明:
学生注册。学生身份:跳转到学生登录界面,点击查询成绩按钮,以表格的形式在该页面显示该学生所有成绩。管理员身份:进入功能选择页面,以列表形式显示超链接,录入成绩、修改成绩、查询成绩。录入成绩页面中,管理员输入学号、课程号和成绩进行录入,点击添加跳出弹框提示是否录入成功;查询成绩界面,可选择按学号查询和按课程号查询,在页面下方以表格形式显示成绩;修改成绩界面,先按学号或课程号查询出成绩,显示当前成绩,可进行修改、删除操作,跳出弹框显示是否修改成功。
1.编写JavaBean,保存信息:
1.1学生信息Student.java
package beans;
public class Student {
private String studentid;
private String studentname;
private String password;
public Student(){}
public Student(String studentid,String studentname,String password){
this.studentid=studentid;
this.studentname=studentname;
this.password=password;
}
public String getStudentid(){
return studentid;
}
public void setStudentid(String studentid){
this.studentid=studentid;
}
public String getStudentname(){
return studentname;
}
public void setStudentname(String studentname){
this.studentname=studentname;
}
public String getPassword(){
return password;
}
public void setPassword(String password){
this.password=password;
}
}
1.2管理员信息Admin.java
package beans;
public class Admin {
private String adminid;
private String adminname;
private String password;
public Admin(){}
public Admin(String adminid,String adminname,String password){
this.adminid=adminid;
this.adminname=adminname;
this.password=password;
}
public String getAdminid(){
return adminid;
}
public void setAdminid(String studentid){
this.adminid=studentid;
}
public String getAdminname(){
return adminname;
}
public void setAdminname(String studentname){
this.adminname=studentname;
}
public String getPassword(){
return password;
}
public void setPassword(String password){
this.password=password;
}
}
1.3课程信息Course.java
package beans;
public class Course {
private String courseid;
private String coursename;
public String getCourseid() {
return courseid;
}
public void setCourseid(String courseid) {
this.courseid = courseid;
}
public String getCoursename() {
return coursename;
}
public void setCoursename(String coursename) {
this.coursename = coursename;
}
}
1.4学生分数Score.java
package beans;
public class Score {
private String studentid;
private String studentname;
private String courseid;
private String coursename;
private String score;
public Score(){}
public Score(String studentid,String courseid,String coursename,String score){
this.studentid=studentid;
this.courseid=courseid;
this.coursename=coursename;
this.score=score;
}
public String getStudentid(){
return studentid;
}
public void setStudentid(String studentid){
this.studentid=studentid;
}
public String getScore(){
return score;
}
public void setScore(String score){
this.score=score;
}
public String getStudentname() {
return studentname;
}
public void setStudentname(String studentname) {
this.studentname = studentname;
}
public String getCourseid() {
return courseid;
}
public void setCourseid(String courseid) {
this.courseid = courseid;
}
public String getCoursename() {
return coursename;
}
public void setCoursename(String coursename) {
this.coursename = coursename;
}
}
2.编写DAO,连接数据库,并定义相关查询分数、增加成绩、删除成绩方法
2.1CourseDAO.java。通过课程号查找课程名方法。
package DAO;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import beans.Course;
import beans.Student;
public class CourseDAO {
private static Connection conn=null;
public static void initConnection() throws Exception{//建立连接
Class.forName("com.mysql.jdbc.Driver");
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/school","root","7277991");
}
public static Course findclasses(String courseid) throws Exception{//查找课程
initConnection();
Statement state =null;
ResultSet rs = null;
Course course=new Course();
try{
String sql = "select * from course where courseid = '"+courseid+"'";
state = conn.createStatement();
rs=state.executeQuery(sql);
if(rs.next()){
course.setCourseid(rs.getString("courseid"));
course.setCoursename(rs.getString("coursename"));
}
}catch(Exception e){
e.printStackTrace();
}finally{
closeConnection();
}
return course;
}
public static void closeConnection() throws Exception{//断开连接
conn.close();
}
}
2.2UserDAO.java。登录时通过学号或管理员账号查找学生或管理员进行登录验证。注册时学生信息增加。
package DAO;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import beans.Admin;
import beans.Student;
public class UserDAO {
private static Connection conn=null;
public static void initConnection() throws Exception{//建立连接
Class.forName("com.mysql.jdbc.Driver");
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/school","root","7277991");
}
public static Student findstudent(String studentid) throws Exception{//查找学生
initConnection();
Statement state =null;
ResultSet rs = null;
Student student=new Student();
try{
String sql = "select * from student where studentid = '"+studentid+"'";
state = conn.createStatement();
rs=state.executeQuery(sql);
if(rs.next()){
student.setStudentid(rs.getString("studentid"));
student.setPassword(rs.getString("password"));
student.setStudentname(rs.getString("studentname"));
}
}catch(Exception e){
e.printStackTrace();
}finally{
closeConnection();
}
return student;
}
public static boolean addStudent(Student student) {//增加学生
boolean flag=false;
int i=0;
try {
initConnection();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Statement state =null;
String sql= "insert into student (studentid,studentname,password) values('"+student.getStudentid()+"','"+student.getStudentname()+"','"+student.getPassword()+"')";
try {
state = conn.createStatement();
i=state.executeUpdate(sql);
if(i>0){
flag=true;
}
}catch (SQLException e) {
e.printStackTrace();
}
try {
closeConnection();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return flag;
}
public static Admin findadmin(String adminid) throws Exception{//查找管理员
initConnection();
Statement state =null;
ResultSet rs = null;
Admin admin=new Admin();
try{
String sql = "select * from admin where adminid = '"+adminid+"'";
state = conn.createStatement();
rs=state.executeQuery(sql);
if(rs.next()){
admin.setAdminid(rs.getString("adminid"));
admin.setPassword(rs.getString("password"));
admin.setAdminname(rs.getString("adminname"));
}
}catch(Exception e){
e.printStackTrace();
}finally{
closeConnection();
}
return admin;
}
public static void closeConnection() throws Exception{//断开连接
conn.close();
}
}
2.3ScoreDAO.java。通过学号或课程号查找成绩。增加、删除、修改成绩等方法。
package DAO;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import beans.Score;
import beans.Student;
public class ScoreDAO {
private static Connection conn=null;
public static void initConnection() throws Exception{//建立连接
Class.forName("com.mysql.jdbc.Driver");
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/school","root","7277991");
}
public static ArrayList findscore1(String studentid) throws Exception{//按学号查找成绩
initConnection();
Statement state =null;
ResultSet rs = null;
ArrayList list=new ArrayList();
try{
String sql = "select score.*,student.studentname,course.coursename from score,student,course where score.studentid=student.studentid and score.courseid=course.courseid and score.studentid = '"+studentid+"'";
state = conn.createStatement();
rs=state.executeQuery(sql);
while(rs.next()){
Score score=new Score();
score.setStudentid(rs.getString("studentid"));
score.setStudentname(rs.getString("studentname"));
score.setCourseid(rs.getString("courseid"));
score.setCoursename(rs.getString("coursename"));
score.setScore(rs.getString("score"));
list.add(score);
}
}catch(Exception e){
e.printStackTrace();
}finally{
closeConnection();
}
return list;
}
public static ArrayList findscore2(String courseid) throws Exception{//按课程号查找成绩
initConnection();
Statement state =null;
ResultSet rs = null;
ArrayList list=new ArrayList();
try{
String sql = "select score.*,student.studentname,course.coursename from score,student,course where score.studentid=student.studentid and score.courseid=course.courseid and score.courseid = '"+courseid+"'";
state = conn.createStatement();
rs=state.executeQuery(sql);
while(rs.next()){
Score score=new Score();
score.setStudentid(rs.getString("studentid"));
score.setStudentname(rs.getString("studentname"));
score.setCourseid(rs.getString("courseid"));
score.setCoursename(rs.getString("coursename"));
score.setScore(rs.getString("score"));
list.add(score);
}
}catch(Exception e){
e.printStackTrace();
}finally{
closeConnection();
}
return list;
}
public static int addscore(String studentid,String courseid,String score) throws Exception{//增加成绩
initConnection();
Statement state =null;
int rs = 0;
try{
String sql = "insert into score(studentid,courseid,score) values('"+studentid+"','"+courseid+"','"+score+"')";
state = conn.createStatement();
rs=state.executeUpdate(sql);
}catch(Exception e){
e.printStackTrace();
}finally{
closeConnection();
}
return rs;
}
public static int updatescore(String studentid,String courseid,String score) throws Exception{//修改成绩
initConnection();
Statement state =null;
int rs = 0;
try{
String sql = "update score set score='"+score+"' where studentid = '"+studentid+"' and courseid='"+courseid+"'";
state = conn.createStatement();
rs=state.executeUpdate(sql);
}catch(Exception e){
e.printStackTrace();
}finally{
closeConnection();
}
return rs;
}
public static int deletescore(String studentid,String courseid) throws Exception{//删除成绩
initConnection();
Statement state =null;
int rs = 0;
try{
String sql = "delete from score where studentid = '"+studentid+"' and courseid='"+courseid+"'";
state = conn.createStatement();
rs=state.executeUpdate(sql);
}catch(Exception e){
e.printStackTrace();
}finally{
closeConnection();
}
return rs;
}
public static void closeConnection() throws Exception{//断开连接
conn.close();
}
}
3.jsp及相关Servlet的编写
3.1登录界面的编写
index.jsp
欢迎登录学生成绩管理系统
用CSS简单美化后登录界面长这样
登录界面的Servlet,login.java
package servlets;
import java.io.IOException;
import java.io.PrintWriter;
import DAO.UserDAO;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import beans.Admin;
import beans.Student;
public class login extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
String userid = request.getParameter("userid");//获取账号
String password = request.getParameter("password");//获取密码
String user=request.getParameter("user");//判断用户身份,学生还是管理员
response.setContentType("text/html;charset=gb2312");
PrintWriter out = response.getWriter();
if(user==null||password==null){//未输入密码
System.out.println("登录失败!");
out.print("");
}else{
if(user.equals("student")){//学生登录时
try {
Student student=UserDAO.findstudent(userid);
if(student.getPassword().equals(password)){
HttpSession session = request.getSession();
session.setAttribute("student",student);
System.out.println("登录成功!");
response.sendRedirect("../stu_showscore.jsp");
}else{
System.out.println("登录失败!");
out.print("");
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{//管理员登录时
try {
Admin admin=UserDAO.findadmin(userid);
if(admin.getPassword().equals(password)){
HttpSession session = request.getSession();
session.setAttribute("admin",admin);
System.out.println("登录成功!");
response.sendRedirect("../admin_menu.jsp");
}else{
System.out.println("登录失败!");
out.print("");
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request,response);
}
}
3.2注册界面
注册界面的jsp,利用JavaScript对输入的账号、密码等输入信息进行简单验证,利用Servlet对输入的账号是否已存在、两次密码是否一致进行验证。
欢迎登录学生成绩管理系统
注册页面的提示效果
注册界面的Servlet,register.java
package servlets;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import DAO.UserDAO;
import beans.Student;
public class register extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
String userid = request.getParameter("userid");//获取账号
String password1 = request.getParameter("password1");//获取第一次输入的密码
String username = request.getParameter("username");//获取姓名
String password2 = request.getParameter("password2");//获取第二次输入的密码
response.setContentType("text/html;charset=gb2312");
PrintWriter out = response.getWriter();
System.out.print(userid);
System.out.print(username);
System.out.print(password1);
System.out.print(password2);
if(userid!=null&&username!=null&&password1!=null&&password2!=null){//页面信息是否填写完整
if(password1.equals(password2)){//两次输入的密码一致
try {
Student student = UserDAO.findstudent(userid);
if(student.getStudentid()!=null){//账号存在
out.print("<");
}else{
student.setStudentid(userid);
student.setStudentname(username);
student.setPassword(password1);
boolean flag=UserDAO.addStudent(student);
if(flag){
out.print("");
}else{
out.print("");
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{
out.print("");
}
}else{
out.print("");
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request,response);
}
}
3.3管理员功能页面
3.3.1管理员登录成功菜单,登录成功后该页面有三个超链接,分别指向具体的功能页面
3.3.2管理员查询成绩页面
成绩查询有两种形式:按学号或按课程号查询,利用表单中的radio进行选择。在servlet中查询,并把结果存到Session中,并在jsp页面判断Session中是否有值,若有,则以表格的形式显示,导入beans包,调用类中的get方法获得相应的值。
学生成绩管理系统-查询成绩
<%
ArrayList list=(ArrayList) session.getAttribute("score");
String flag=(String) session.getAttribute("flag");
if(list!=null&&list.size()!=0){
if(flag.equals("stu")){%>
学号为<%=list.get(0).getStudentid() %>的学生成绩如下
<% }else{%>
课程号为<%=list.get(0).getCourseid()%>的全体学生成绩如下
<%}%>
学生学号
学生姓名
课程名
成绩
<%
for(int j=0;j
<%=list.get(j).getStudentid() %>
<%=list.get(j).getStudentname()%>
<%=list.get(j).getCoursename()%>
<%=list.get(j).getScore()%>
<% }}%>
查询结果显示如下
查询成绩操作的servlet如下
package servlets;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import DAO.CourseDAO;
import DAO.ScoreDAO;
import DAO.UserDAO;
import beans.Course;
import beans.Score;
import beans.Student;
public class showscore extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=gb2312");
String flag=request.getParameter("flag");//按学号还是课程号查找
String id=request.getParameter("id");//获取的id值
String func=request.getParameter("func");//从哪个页面传来的表单
PrintWriter out = response.getWriter();
HttpSession session = request.getSession();
if(flag.equals("stu")){//按学号查找成绩
session.setAttribute("flag", flag);
try {
Student student=UserDAO.findstudent(id);
if(student.getStudentid()!=null){//输入的学号存在
try {
ArrayList list=(ArrayList) ScoreDAO.findscore1(id);
session.setAttribute("score", list);
if(func.equals("show"))//从admin_showscore.jsp传来的值
response.sendRedirect("../admin_showscore.jsp");
else//从admin_updatescore.jsp传来的值
response.sendRedirect("../admin_updatescore.jsp");
}catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{//学号不存在
if(func.equals("show")){
out.print("");
}else{
out.print("");
}
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}else{//按课程号查找成绩
try {
Course course=CourseDAO.findclasses(id);
if(course.getCourseid()!=null){
ArrayList list;
try {
session.setAttribute("flag", flag);
list = (ArrayList) ScoreDAO.findscore2(id);
session.setAttribute("score", list);
if(func.equals("show"))
response.sendRedirect("../admin_showscore.jsp");
else
response.sendRedirect("../admin_updatescore.jsp");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{
if(func.equals("show")){
out.print("");
}else{
out.print("");
}
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request,response);
}
}
3.3.3管理员录入成绩页面
管理员需输入学生号、课程号、成绩,利用form表单,把其提交到servlet中,在servlet中要判断学生号和课程号是否在数据库中存在,不存在则跳出相应的警告框。
学生成绩管理系统-录入成绩
输出下列信息进行分数录入
学生学号
课程号
成绩
页面如下
录入成绩的servlet
package servlets;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import DAO.CourseDAO;
import DAO.ScoreDAO;
import DAO.UserDAO;
import beans.Course;
import beans.Score;
import beans.Student;
public class addscore extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=gb2312");
String studentid=request.getParameter("studentid");//获取学号
String courseid=request.getParameter("courseid");//获取课程号
String score=request.getParameter("score");//获取成绩
PrintWriter out = response.getWriter();
try {
Student student=UserDAO.findstudent(studentid);//查找学生
Course course=CourseDAO.findclasses(courseid);//查找课程
System.out.print(student.getStudentid());
if(student.getStudentid()!=null){//存在该学生
if(course.getCourseid()!=null){//存在该课程
try {
int i=ScoreDAO.addscore(studentid,courseid,score);
if(i!=0){
out.print("");
}else{
out.print("");
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}else{
out.print("");
}
}else{
out.print("");
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request,response);
}
}
3.3.4管理员修改、删除成绩
管理员首先通过学号或课程号查询成绩,查询成绩的servlet是3.3.2中的servlet,在提交表单时,定义了一个名为func的隐藏表单,判断是哪个页面传来的查询操作,并在查询结束后,返回到该页面,在本页面显示成绩,成绩为一个输入框,且在每行成绩后有修改和删除两个按钮。两个按钮分别对应两个表单,提交表单时把隐藏表单中的相应学生信息传入servlet中处理。
页面jsp代码
学生成绩管理系统-修改成绩
<%
ArrayList list=(ArrayList)session.getAttribute("score");
String flag=(String) session.getAttribute("flag");
if(list!=null&&list.size()!=0){
if(flag.equals("stu")){%>
学号为<%=list.get(0).getStudentid() %>的学生成绩如下
<% }else{%>
课程号为<%=list.get(0).getCourseid()%>的全体学生成绩如下
<%}%>
学生学号
学生姓名
课程名
成绩
修改
是否删除
<%
for(int j=0;j
<%=list.get(j).getStudentid() %>
<%=list.get(j).getStudentname()%>
<%=list.get(j).getCoursename()%>
<%}
} %>
页面如下
修改成绩的servlet代码
package servlets;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import DAO.ScoreDAO;
import beans.Score;
public class updatescore extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=gb2312");
String studentid=request.getParameter("studentid");//获取学号
String courseid=request.getParameter("courseid");//获取课程号
String score=request.getParameter("score");//获取成绩
int i = 0;
PrintWriter out = response.getWriter();
HttpSession session = request.getSession();
ArrayList list = (ArrayList) session.getAttribute("score");
try {
i=ScoreDAO.updatescore(studentid,courseid,score);
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
for(int j=0;jalert('修改成功');"
+ "window.location.href='../admin_updatescore.jsp'");
}else{
out.print("");
}
//response.sendRedirect("../admin_updatescore.jsp");
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request,response);
}
}
删除成绩的servlet
package servlets;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import DAO.ScoreDAO;
import beans.Score;
public class deletescore extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=gb2312");
String studentid=request.getParameter("studentid");//获取学号
String courseid=request.getParameter("courseid");//获取课程号
int i=0;
PrintWriter out = response.getWriter();
HttpSession session = request.getSession();
ArrayList list = (ArrayList) session.getAttribute("score");
try {
i=ScoreDAO.deletescore(studentid,courseid);//进行删除操作
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
for(int j=0;jalert('删除成功');"
+ "window.location.href='../admin_updatescore.jsp'");
}else{
out.print("");
}
// response.sendRedirect("../admin_updatescore.jsp");
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request,response);
}
}
3.4学生页面
学生在登录时,登录信息存储在session中,session中的学号以隐藏表单形式存在,学生点击查询成绩时,跳转到相应的servlet页面。与管理员查询成绩操作相同,就不赘述了。
3.5返回、退出界面
返回或登录时,利用表单传入servlet中进行操作,在session中把相应的session值进行清除再返回上个页面
package servlets;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class exit extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=gb2312");
String exit=request.getParameter("exit");
HttpSession session = request.getSession();
if(exit.equals("user")){
session.invalidate();
response.sendRedirect("../index.jsp");
}else{
session.removeAttribute("score");
response.sendRedirect("../admin_menu.jsp");
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request,response);
}
}