基于Ajax+Servlet+JSP技术的学生信息管理系统.zip
立即下载
资源介绍:
基于Ajax+Servlet+JSP技术开发的学生信息管理系统,是一种经典的Web应用架构,结合了前端与后端技术,旨在提供动态、交互式的用户体验。下面是对这个系统在资源管理方面的概述,包括主要组成部分、工作原理及优势。
主要组成部分
Ajax :
负责在后台与服务器交换数据,这意味着用户可以在不重新加载整个网页的情况下,获取并更新部分网页内容。Ajax使得页面能够异步通信,提升用户体验。
Servlet:
作为Java Web应用程序中的服务器端组件,负责处理HTTP请求并返回响应。在学生信息管理系统中,Servlet接收来自Ajax的请求,处理业务逻辑(如查询数据库、更新记录等),然后将结果以JSON或其他格式返回给前端。
JSP :
用于生成动态网页内容。JSP页面中可以嵌入Java代码,便于展示从Servlet获取的数据。在学生信息管理系统中,JSP页面展示学生列表、详细信息等界面,并通过Ajax调用与后台交互。
package org.Dao.Impl;
import org.Dao.ScoreDao;
import org.Entity.ScoreEntity;
import org.Utils.DbUtil;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public class ScoreDaoImpl implements ScoreDao {
private ScoreEntity score;
private DbUtil dbCon = new DbUtil();
// 添加成绩
public int addScore(ScoreEntity score) {
String sql = "insert into score(stu_num,stu_name,stu_class,course_name,score_grade,major) values('"
+ score.getStuNum()
+ "','"
+ score.getStuName()
+ "','"
+ score.getStuClass()
+ "','"
+ score.getCourseName()
+ "',"
+ score.getScoreGrade() + ",'" + score.getMajor() + "')";
int rs = dbCon.query(sql);
return rs;
}
// 删除成绩
public int deleteScore(int scoreID) {
String sql = "delete from score where score_id=" + scoreID;
int rs = dbCon.query(sql);
return rs;
}
// 修改成绩
public int editCos(ScoreEntity score) {
String sql = "update score set stu_num='" + score.getStuNum()
+ "',stu_name='" + score.getStuName() + "',stu_class='"
+ score.getStuClass() + "',course_name='"
+ score.getCourseName() + "',score_grade="
+ score.getScoreGrade() + ",major='" + score.getMajor()
+ "' where score_id=" + score.getScoreID();
int rs = dbCon.query(sql);
return rs;
}
// 查询所有成绩
public List findAll() {
List list = new ArrayList();
String sql = "select * from score";
ResultSet rs = dbCon.find(sql);
try {
while (rs.next()) {
int scoreID = rs.getInt("score_id");
String stuNum = rs.getString("stu_num");
String stuName = rs.getString("stu_name");
String stuClass = rs.getString("stu_class");
String courseName = rs.getString("course_name");
double scoreGrade = rs.getDouble("score_grade");
String major = rs.getString("major");
score = new ScoreEntity(scoreID, stuNum, stuName, stuClass,
courseName, scoreGrade, major);
list.add(score);
}
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}
//根据学生学号查询成绩
public List selectStudentId(String stunum) {
List list = new ArrayList();
String sql = "select * from score where stu_num='" + stunum +"'";
ResultSet rs = dbCon.find(sql);
try {
while (rs.next()) {
int scoreid = rs.getInt("score_id");
String stuNum = rs.getString("stu_num");
String stuName = rs.getString("stu_name");
String stuClass = rs.getString("stu_class");
String courseName = rs.getString("course_name");
double scoreGrade = rs.getDouble("score_grade");
String major = rs.getString("major");
score = new ScoreEntity(scoreid, stuNum, stuName, stuClass,
courseName, scoreGrade, major);
list.add(score);
}
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}
//根据学生姓名查询成绩
public List selectStudentName(String stuNames) {
List list = new ArrayList();
String sql = "select * from score where stu_name='" + stuNames +"'";
ResultSet rs = dbCon.find(sql);
try {
while (rs.next()) {
int scoreid = rs.getInt("score_id");
String stuNum = rs.getString("stu_num");
String stuName = rs.getString("stu_name");
String stuClass = rs.getString("stu_class");
String courseName = rs.getString("course_name");
double scoreGrade = rs.getDouble("score_grade");
String major = rs.getString("major");
score = new ScoreEntity(scoreid, stuNum, stuName, stuClass,
courseName, scoreGrade, major);
list.add(score);
}
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}
//根据课程名称查询成绩
public List selectCourseName(String courseNames) {
List list = new ArrayList();
String sql = "select * from score where course_name='" + courseNames +"'";
ResultSet rs = dbCon.find(sql);
try {
while (rs.next()) {
int scoreid = rs.getInt("score_id");
String stuNum = rs.getString("stu_num");
String stuName = rs.getString("stu_name");
String stuClass = rs.getString("stu_class");
String courseName = rs.getString("course_name");
double scoreGrade = rs.getDouble("score_grade");
String major = rs.getString("major");
score = new ScoreEntity(scoreid, stuNum, stuName, stuClass,
courseName, scoreGrade, major);
list.add(score);
}
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}
}
资源文件列表:
基于Ajax+Servlet+JSP技术的学生信息管理系统.zip 大约有263个文件