?? viewcourse.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 "";
}
private String isChecked(String value1, String value2) {
if (value1 != null && value2 != null && value1.equals(value2))
return "checked";
else
return "";
}
%>
<%
request.setCharacterEncoding("gb2312");
CourseBean courseBean = new CourseBean();
//以下是得到頁面的參數(shù)
String commitFlag = (String) request.getParameter("queryButton");//得到按鈕事件
String term = request.getParameter("term");
String courseType = request.getParameter("courseType");
String courseInfo = request.getParameter("courseInfo");
String queryType = request.getParameter("RadioGCourseInfo");
ArrayList courseList = null;
if (term != null && term.equals("all")) {
term = null;
}
if (courseType != null && courseType.equals("all")) {
courseType = null;
}
if(queryType == null || queryType.equals("")){
queryType = "1";
}
if (courseInfo != null && courseInfo.length() > 0) {
//以下是根據(jù)選擇了不同的單選按鈕來調(diào)用不同的方法來查詢課程信息
if (queryType != null && queryType.equals("1")) {//按照課程編號來查詢
courseList = courseBean.queryByCourseId(courseType, term, courseInfo);
}
else if (queryType != null && queryType.equals("2")) {//按照課程名來查詢
courseList = courseBean.queryByName(courseType, term, courseInfo);
}
else if (queryType != null && queryType.equals("3")) {//按照課程名模糊查詢
courseList = courseBean.queryByNameImprecise(courseType, term, courseInfo);
}
}
else {
courseList = courseBean.queryByCourseId(courseType, term, null);
}
%>
<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="99%" border="0">
<tr>
<td> </td>
</tr>
<tr>
<td height="20" bgcolor="#999999">
<form name="form1" method="post" action="viewCourse.jsp">
<table width="100%" border="0">
<tr>
<td width="17%" height="58">
學(xué)期
<select name="term">
<option id="0" value="all">所有學(xué)期</option>
<option id="1" value="1">第1學(xué)期</option>
<option id="2" value="2">第2學(xué)期</option>
<option id="3" value="3">第3學(xué)期</option>
<option id="4" value="4">第4學(xué)期</option>
<option id="5" value="5">第5學(xué)期</option>
<option id="6" value="6">第6學(xué)期</option>
<option id="7" value="7">第7學(xué)期</option>
<option id="8" value="8">第8學(xué)期</option>
</select>
</td>
<td width="21%">課程類型
<select name="courseType">
<option id="0" value="all">所有課程</option>
<option id="1" value="A">A類課程</option>
<option id="2" value="B">B類課程</option>
<option id="3" value="C">C類課程</option>
</select>
</td>
<td width="25%"> 課程信息:
<input name="courseInfo" type="text" class="text1" value="<%=courseInfo==null?"":courseInfo%>">
</td>
<td width="27%">
<table width="100%" border="0">
<tr>
<td width="12%">
<input type="radio" name="RadioGCourseInfo" value="1">
</td>
<td width="88%">課程號</td>
</tr>
<tr>
<td>
<input type="radio" name="RadioGCourseInfo" value="2">
</td>
<td>課程名精確查詢</td>
</tr>
<tr>
<td>
<input type="radio" name="RadioGCourseInfo" value="3">
</td>
<td>課程名模糊查詢</td>
</tr>
</table>
</td>
<td width="10%">
<input name="queryButton" type="submit" class="button1" value="查詢">
</td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td height="380" valign="top">
<%
if (courseList != null && courseList.size() > 0) {
CourseBean courseBean2 = null;
Iterator it = courseList.iterator();
String temp = "";
String temp2 = "";
while (it.hasNext()) {
courseBean2 = (CourseBean) it.next();
temp = String.valueOf(courseBean2.getBeginTime()) + "-" + String.valueOf(courseBean2.getEndTime()) + "周";
temp2 = "周" + courseBean2.getWeek() + "," + String.valueOf((courseBean2.getPeriod() * 2) - 1) + "-" + String.valueOf(courseBean2.getPeriod() * 2) + "節(jié)";
%>
<table width="100%" border="1" bordercolorlight=#C1A4F4 borderColorDark=#ffffff cellPadding=0 cellSpacing=0>
<tr>
<th width="9%" scope="col">課程號</th>
<th width="22%" scope="col">課程名</th>
<th width="13%" scope="col">主講教師</th>
<th width="8%" scope="col">類型</th>
<th width="15%" scope="col">上課時間</th>
<th width="14%" scope="col">時間(周)</th>
<th width="11%" scope="col">上課地點</th>
<th width="8%" scope="col">學(xué)期</th>
</tr>
<tr>
<th scope="row"><%=courseBean2.getCourseId()%> </th>
<td align="center"><%=courseBean2.getCourseName()%> </td>
<td align="center"><a href="viewTeacherInfo.jsp?teacherId=<%=courseBean2.getTeacherId()%>"><%=courseBean2.getTeacherName()%> </td>
<td align="center"><%=courseBean2.getCourseType()%> </td>
<td align="center"><%=temp2%> </td>
<td align="center"><%=temp%> </td>
<td align="center"><%=courseBean2.getClassRoom()%> </td>
<td align="center"><%=courseBean2.getTerm()%> </td>
</tr>
<tr>
<th height="27" scope="row">課程描述</th>
<td colspan="7"> <%=courseBean2.getDescription()%></td>
</tr>
</table>
<%
}
}else{
%>
<script language="javascript" type="">
alert('沒有該課程信息!');
</script>
<%
}
%>
</td>
</tr>
<tr>
<td height="27"> </td>
</tr>
</table>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -