?? undochoosecourse.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%"> </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 + -