📄 viewcoursescheme.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 commitFlag = request.getParameter("queryButton");
String term = null;
String classId = null;
String studentId = null;
StudentBean stuBean = null;
Hashtable hTable = null;
stuBean = (StudentBean) session.getAttribute("studentBean");
if (stuBean != null) {//如果学生已经登录,进行下一步操作
classId = stuBean.getClassId();
studentId = stuBean.getStudentId();
if (commitFlag != null) {//如果是单击了查询按钮从页面参数中得到学期
term = request.getParameter("term");
}else {
//默认查询根据系统时间计算得到的目前学生是第几学期的数据,
//如学生入学年份为2005-09-01,当前时间为2006-3月,则查询第2学期的数据。
System.out.println("test in viewCourseScheme.jsp://///////////////////");////////////////////
term = String.valueOf(stuBean.getCurrentTerm());
}
System.out.println("test in viewCourseScheme.jsp:term:"+term);/////////////////////////
CourseBean courseBean = new CourseBean();
hTable = courseBean.queryCourseScheme(classId, studentId, term);//查询课程安排情况
}else{//如果学生还没有登录,转发到登录页面
RequestDispatcher dispatcher = request.getRequestDispatcher("/login.jsp");
dispatcher.forward(request,response);
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>查看课表</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
background-color: #CCCCCC;
margin-top: 0px;
margin-bottom: 0px;
}
-->
</style></head>
<body>
<table width="100%" border="0">
<tr>
<td height="18"> </td>
</tr>
<tr>
<td height="35">
<form name="form1" method="POST" action="viewCourseScheme.jsp">
<table width="100%" border="0">
<tr bgcolor="#999999">
<td width="44%" align="right" valign="top"> 学期:
<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="16%"> </td>
<td width="40%">
<input name="queryButton" type="submit" class="button1" value="查询">
</td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td height="307">
<%
if (hTable != null) {
CourseBean courseBean2 = null;
%>
<table width="100%" border="1" bordercolorlight= #C1A4F4 borderColorDark=#ffffff cellPadding=0 cellSpacing=0 >
<tr>
<th scope="col" width="20%">星期一</th>
<th scope="col" width="20%">星期二</th>
<th scope="col" width="20%">星期三</th>
<th scope="col" width="20%">星期四</th>
<th scope="col" width="20%">星期五</th>
</tr>
<%
for (int i = 1; i <= 5; i++) {
%>
<tr>
<%
String week = null;
String period = null;
for (int j = 1; j <=5; j++) {
week = String.valueOf(j);
period = String.valueOf(i);
String temp = week + "-" + period;
courseBean2 = (CourseBean) hTable.get(temp);
if(courseBean2 == null){
%>
<td>
<table width="100%" border="0">
<tr>
<td> </td>
</tr>
<tr>
<td align="center"><a href="chooseCourse.jsp?term=<%=term%>&week=<%=week%>&period=<%=period%>">选课</a></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</td>
<%
}else{
String tempStr = null;
if(courseBean2.getCourseType().equals("A")){
tempStr = "(必修)";
}else{
tempStr = "("+courseBean2.getCourseType()+"类)";
}
%>
<td>
<table width="100%" border="0">
<tr>
<td align="center"><%=courseBean2.getCourseName()+tempStr%></td>
</tr>
<tr>
<td align="center"><%=courseBean2.getTeacherName()%></td>
</tr>
<tr>
<td align="center"><%=courseBean2.getBeginTime()+"-"+courseBean2.getEndTime()+" 周"%><%=courseBean2.getClassRoom()%></td>
</tr>
</table>
</td>
<%
}
}
%>
</tr>
<%
}
%>
</table>
<%} %>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -