?? selectcourse.jsp
字號:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'selectCourse.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<SCRIPT>
function sub() {
var form = document.getElementById("form1");
form.action="/SelectCourse/selectCourse.do?index=find";
form.submit();
}
function subSelect(id) {
var form = document.getElementById("form1");
form.action="/SelectCourse/selectCourse.do?index=select&id="+id;
form.submit();
}
</SCRIPT>
<%
ArrayList list = (ArrayList)request.getAttribute("course");
%>
</head>
<body>
<CENTER>
<DIV><h2><strong>課程信息</strong></h2></DIV>
<br><br><br>
</CENTER>
<FORM id="form1" method="post">
課程名<INPUT type="text" id="text" name="text">
查詢方式
<INPUT type="radio" name="method" id="all" value="all" checked="checked">所有
<INPUT type="radio" name="method" id="course" value="course">課程名
<INPUT type="radio" name="method" id="credit" value="credit">學分
<INPUT type="radio" name="method" id="teacher" value="teacher">教師姓名
<INPUT type="button" value="查詢" onclick="sub()">
<br><br><br>
<center>
<TABLE border="3" width="400px" bordercolor="#0066FF">
<tr align="center" style="background-color:#0066FF;">
<TD>
課程名
</TD>
<TD>
學分
</TD>
<TD>
任課教師
</TD>
<TD>
選擇
</TD>
</TR>
<%
if(list.size()!=0) {
HashMap map = null;
String course_id = null;
String course_name = null;
String teacher_name = null;
String course_credit = null;
for(int i = 0; i < list.size(); i++) {
map = (HashMap)list.get(i);
course_id = map.get("course_id").toString();
course_name = map.get("course_name").toString();
course_credit = map.get("course_credit").toString();
teacher_name = map.get("teacher_name").toString();
%>
<TR align = "center">
<td><%=course_name%>
</td>
<td><%=course_credit%>
</td>
<td><%=teacher_name%>
</td>
<TD>
<INPUT type = "button" value="選擇" onclick="subSelect('<%=course_id%>')">
</TD>
</TR>
<%
}
}
%>
</TABLE>
</FORM>
</CENTER>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -