⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 undochoosecourse.jsp

📁 学生信息管理系统 jsp + sql + javabean 实现
💻 JSP
字号:
<%@page contentType="text/html; charset=gb2312" errorPage=""%>
<%@page import="java.sql.*,sms.db.*,sms.bean.*,java.util.*"%>
<%!
  private String isSelected(String value1, String value2) {
    if (value1 != null && value2 != null && value1.equals(value2)){
      return "selected";
    }
    else{
      return "";
    }
  }
%>
<%
  String UndoFlag = request.getParameter("UndoButton");
  String queryFlag = request.getParameter("queryButton");
  String term = null;
  String classId = null;
  String studentId = null;
  StudentBean stuBean = null;
  ArrayList courseList = null;
  stuBean = (StudentBean) session.getAttribute("studentBean");
  if (stuBean != null) {//如果学生已经登录系统
    studentId = stuBean.getStudentId();
    CourseBean courseBean = new CourseBean();
    if (queryFlag != null) {//如果是页面提交了查询按钮,则根据页面提交的学期来查询
      term = request.getParameter("term");
    }else{//如果是首次进入该页面,根据学生的当前学期查询
      term = String.valueOf(stuBean.getCurrentTerm());
    }
    courseList = courseBean.queryChoosedCourse(term, studentId);
    if (UndoFlag != null ) {//页面提交了退选按钮
      String courseId = request.getParameter("selectCourseId");
      if (courseId == null || courseId.equals("")) {
%>
<script language="javascript" type="">
         alert('请选择一条记录!');
</script>
<%
  } else {
    CourseSchemeBean cSchemeBean = new CourseSchemeBean();
    boolean flag = cSchemeBean.undoChooseCourse(studentId, courseId);
    if (flag == true) {
%>
<script language="javascript" type="">
         alert('退选课程成功!');
</script>
<%} else {%>
<script language="javascript" type="">
         alert('退选课程失败!');
</script>
<%
  }
  }
  }
}else{//如果学生还未登录系统,转发到登录页面
%>
<jsp:forward page="login.jsp"></jsp:forward>
<%
}
%>
<html>
<head>
<title>退选课程</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	background-color: #CCCCCC;
}
body,td,th {
	color: #000000;
}
-->
</style>
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<form name="form1" method="post" action="undoChooseCourse.jsp">
<input type="hidden" name="commitFlag" value="">
<table width="100%" border="0">
        <tr>
          <td height="25">
            <table width="100%" border="0">
              <tr bgcolor="#999999">
                <td width="32%" align="right">                  第
                  <select name="term">
                    <option id="1" value="1" <%=isSelected(term,"1")%>>1</option>
                    <option id="2" value="2" <%=isSelected(term,"2")%>>2</option>
                    <option id="3" value="3" <%=isSelected(term,"3")%>>3</option>
                    <option id="4" value="4" <%=isSelected(term,"4")%>>4</option>
                    <option id="5" value="5" <%=isSelected(term,"5")%>>5</option>
                    <option id="6" value="6" <%=isSelected(term,"6")%>>6</option>
                    <option id="7" value="7" <%=isSelected(term,"7")%>>7</option>
                    <option id="8" value="8" <%=isSelected(term,"8")%>>8</option>
                  </select>
                  学期
                </td>
                <td width="36%">&nbsp;</td>
                <td width="32%">
                  <input name="queryButton" type="submit" value="查询">
                </td>
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td valign="top">
          <%
            if (courseList != null && courseList.size() > 0) {
              CourseBean courseBean2 = null;
          %>
            <table width="100%" border="1" bordercolorlight= #C1A4F4  borderColorDark=#ffffff cellPadding=0 cellSpacing=0 >
              <tr>
                <th scope="col" height="25">选择</th>
                <th scope="col">课程号</th>
                <th scope="col">课程名</th>
                <th scope="col">类型</th>
                <th scope="col">教师</th>
                <th scope="col">上课时间</th>
                <th scope="col">教室</th>
                <th scope="col">课程描述</th>
              </tr>
            <%
              System.out.println("courseList.size:" + courseList.size()); //////////////////////////////
              CourseBean courseBean3 = null;
              Iterator it = courseList.iterator();
              String temp = "";
              while (it.hasNext()) {
                courseBean3 = (CourseBean) it.next();
                temp = String.valueOf(courseBean3.getBeginTime()) + "-" + String.valueOf(courseBean3.getEndTime()) + "周,";
            %>
              <tr>
                <td align="center">
                  <input name="selectCourseId" type="radio" value="<%=courseBean3.getCourseId()%>">
                </td>
                <td align="center"><%=courseBean3.getCourseId()%>                </td>
                <td align="center"><%=courseBean3.getCourseName()%>                </td>
                <td align="center"><%=courseBean3.getCourseType()%>                </td>
                <td align="center"><%=courseBean3.getTeacherName()%>                </td>
                <td align="center"><%=temp%>                </td>
                <td align="center"><%=courseBean3.getClassRoom()%>                </td>
                <td align="center"><%=courseBean3.getDescription()%>                </td>
              </tr>
            <%}%>
            </table>
          <%}          %>
          </td>
        </tr>
        <tr>
          <td height="35">
            <input type="submit" name="UndoButton" value="退选">
          </td>
        </tr>
      </table>

</form>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -