100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > 基于javaweb+JSP+Servlet学生选课系统(管理员 教师 学生)

基于javaweb+JSP+Servlet学生选课系统(管理员 教师 学生)

时间:2024-02-12 15:49:03

相关推荐

基于javaweb+JSP+Servlet学生选课系统(管理员 教师 学生)

基于javaweb+JSP+Servlet学生在线选课系统(管理员、教师、学生)

开发工具:eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

row=pstmt.executeUpdate();if(row>0) {return true;}else {return false;}}catch(ClassNotFoundException e) {e.printStackTrace();return false;}catch(SQLException e) {e.printStackTrace();return false;}catch(Exception e) {e.printStackTrace();return false;}finally {try {

if(!result) {//注册失败request.setAttribute("error", "addError");}else {//注册成功request.setAttribute("error", "addSuccess");}request.getRequestDispatcher("addcourse.jsp").forward(request, response);//StudentQueryAllServlet直接转发给StudentInfoList.jsp,不需要进行处理}/*** @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)*/protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {// TODO Auto-generated method stubdoGet(request, response);}}

return null;}catch(Exception e) {e.printStackTrace();return null;}finally {try {if(rs!=null)rs.close();if(pstmt!=null)pstmt.close();if(connection!=null)connection.close();}catch(SQLException e) {e.printStackTrace();}}}//录入成绩public boolean addGrade(Grade grade) {Connection connection=null;PreparedStatement pstmt=null;int row;try{DBUtil con=new DBUtil();connection=con.getConnection();String sql="update choosecourse set grade=? where sId=? and cId=?";

pstmt=connection.prepareStatement(sql);pstmt.setString(1, sid);rs=pstmt.executeQuery();while(rs.next()) {String cid=rs.getString("choosecourse.cId");String cname=rs.getString("cName");String credit=rs.getString("credit");String period=rs.getString("period");String cplace=rs.getString("cPlace");String tname=rs.getString("tName");course=new Course(cid,cname,credit,period,cplace,tname);courses.add(course);}return courses;

}catch(Exception e) {e.printStackTrace();return null;}finally {try {if(rs!=null)rs.close();if(pstmt!=null)pstmt.close();if(connection!=null)connection.close();}catch(SQLException e) {e.printStackTrace();}}}

<li><a href="AdminDeleteServlet?aid=<%=(String)session.getAttribute("id")%>">注销</a><hr></li></ul><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></div></nav></div></div><div id="mainRight"><div id="nav-wrapper1"><nav><div><% String info=(String)request.getAttribute("error");if(info!=null){if(info.equals("addError")){out.print("添加失败!");

}#middle > div {display: table-row; }#middle > div > div {display: table-cell; vertical-align: top; }#mainLeft {width: 190px;transition: width 0.4s;padding-left: 7px;padding-top:20px;}#middle{display:table;table-layout:fixed;margin-top:0;width:100%;heigth:950px;}#nav-wrapper{margin-top: 2px;padding: 0.75em;background-color:#87CEFA;border-right: 1px solid #bbb;border-bottom: 1px solid #bbb;

package com.demo.servlet;import java.io.IOException;import java.util.List;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import com.demo.service.AdminService;import com.demo.vo.Student;import com.demo.vo.*;/*** Servlet implementation class AllStuQueryServlet*/

}}}//增加老师public boolean addTeacher(Teacher teacher1) {Connection connection=null;PreparedStatement pstmt=null;int row;try{DBUtil con=new DBUtil();connection=con.getConnection();String sql="insert into teacher(tId,tName,tPass,dId) values(?,?,?,?)";pstmt=connection.prepareStatement(sql);pstmt.setString(1, teacher1.gettId());//替换上面第一个?pstmt.setString(2, teacher1.gettName());//替换上面第二个?pstmt.setString(3, teacher1.gettPass());

if(pstmt!=null)pstmt.close();if(connection!=null)connection.close();}catch(SQLException e) {e.printStackTrace();}}}//根据学号查询学生个人信息public Student queryBySid(String sid) {Connection connection=null;PreparedStatement pstmt=null;ResultSet rs=null;

row=pstmt.executeUpdate();//返回增加数据的条数(这里是返回1)if(row>0) {return true;}else {return false;}}catch(ClassNotFoundException e) {e.printStackTrace();return false;}catch(SQLException e) {e.printStackTrace();return false;}catch(Exception e) {e.printStackTrace();return false;}finally {try {if(pstmt!=null)pstmt.close();if(connection!=null)connection.close();}catch(SQLException e) {e.printStackTrace();

Connection connection=null;PreparedStatement pstmt=null;int row;try{DBUtil con=new DBUtil();connection=con.getConnection();String sql="insert into course(cId,cName,tId,credit,period,cPlace,cNumAll,cNum,dId) values(?,?,?,?,?,?,?,?,?)";pstmt=connection.prepareStatement(sql);pstmt.setString(1, course.getcId());//替换上面第一个?pstmt.setString(2, course.getcName());//替换上面第二个?pstmt.setString(3, course.gettId());pstmt.setString(4, course.getCredit());pstmt.setString(5, course.getPeriod());//替换上面第一个?pstmt.setString(6, course.getcPlace());//替换上面第二个?pstmt.setString(7, course.getcNumAll());pstmt.setString(8, course.getcNum());pstmt.setString(9, course.getdId());row=pstmt.executeUpdate();//返回增加数据的条数(这里是返回1)

运行环境

Java≥8、Tomcat≥7.0、MySQL≥5.5

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

技术框架

CSS JavaScriptJSPServletJDBCMySQL

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

管理员:个人信息、学生、老师、学生、课程等管理

教师:个人信息、成绩、选课管理、教室查看

学生:个人信息、成绩查看、选课和查看

eclipse或MyEclipse或idea

管理员

学生

教师

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。