好文档 - 专业文书写作范文服务资料分享网站

基于JSP的教务管理系统设计与实现

天下 分享 时间: 加入收藏 我要投稿 点赞

fault=\>

{stu_id.text}

{studentname.text}

{sex.text}

{speciality.text}

{academe.text}

{grade.text}

4.3.3 在线选课页面

学生在线选课页面如图4.7所示,在此页面中学生可根据教务安排的选修课情况对自己感兴趣的课程进行选择,但是课程一经选定不允许退选。

图4.7 在线选课页面

实现该页面的功能代码如下所示: public List SelectCourse() {

List list = new ArrayList(); DBTools db = new DBTools();

String sql = \; ResultSet rs = db.select(sql); TeachPlan teachplan = null; try {

while (rs.next()) { }

teachplan = new TeachPlan(); teachplan.setId(rs.getInt(\));

teachplan.setCourse_name(rs.getString(\)); teachplan.setCourse_kind(rs.getString(\)); teachplan.setBegin_term(rs.getString(\));

teachplan.setBegin_speciality(rs.getString(\)); teachplan.setPeriod(rs.getString(\)); list.add(teachplan);

} catch (SQLException e) {

}

e.printStackTrace();

} finally { } return list;

try {

rs.close();

} catch (SQLException e) { }

e.printStackTrace();

public boolean addcourses(String stu_id, String overcourse) {

boolean flag = false;

boolean b = checkcourse(stu_id,overcourse); DBTools tool = new DBTools(); if (b) {

addcoursetoselect(stu_id,overcourse); List list = getTheStudent(stu_id); String name = list.get(0).getName(); String password = list.get(0).getPassword(); String sex = list.get(0).getSex();

String speciality = list.get(0).getSpeciality(); String academe = list.get(0).getAcademe(); String grade = list.get(0).getGrade(); String status = list.get(0).getStatus();

String sql= \ + stu_id + \ + name

+ \ + password + \ + sex + \ + speciality + \ + academe + \ + grade + \ + overcourse + \ + status + \;

int rs = tool.update(sql); if (rs == 1) {

}

}

}

flag = true;

return flag;

public boolean checkcourse(String stu_id, String overcourse){

boolean flag=false;

String sql = \overcourse from education.stuinfo where stu_id='\ +

stu_id+ \;

}

public boolean addcoursetoselect(String stu_id, String course_name){

DBTools db = new DBTools(); ResultSet rs = db.select(sql); try {

outer:while(rs.next()){ }

String str = rs.getString(\); if(str.equals(overcourse)){

flag = false; break outer;

}else{flag=true;}

} catch (SQLException e) { } return flag;

e.printStackTrace();

boolean flag=false;

DBTools db = new DBTools(); String str2=ads(stu_id,course_name); System.out.println(str2);

String sql= \into selectcourseinfo values('\ + course_name + \ +

stu_id+ \ + str2 + \;

int rs = db.update(sql); if (rs == 1) { flag = true;

} return flag;

}

public String ads(String stu_id, String teachcourse){ String str=null;

String sql1=\teach_id from teachinfo where teachcourse='\teachcourse+ \;

DBTools db=new DBTools(); ResultSet rs = db.select(sql1); try { while(rs.next()){

str = rs.getString(\);

}

} catch (SQLException e) { e.printStackTrace();

} return str;

}

{user_name}

{selectdg.selectedItem.course_name}

+

524h80lc0i4bptb11x4w7g2499ip7300mmk
领取福利

微信扫码领取福利

微信扫码分享