<%@ page contentType="text/html; charset=iso8859_1" language="java" import="java.sql.*" errorPage="" %>
<html >
<head>
<title>无标题文档</title>
</head>
<body background="jpg/4.jpg">
<%
//String name = (String)session.getAttribute("student_id");
String a_courid2 = request.getParameter("a_courid");
//out.println(session.getAttribute("student_n"));
Connection con;
Statement sql;
ResultSet rs;
%>
<hr>
<br>
<form id="form1" name="form1" method="post" action="add_course.jsp">
<table border="1" align="center">
<tr>
<th>课程号</th>
<th>课程名称</th>
<th>学分</th>
<th>学时</th>
<th>教师</th>
<th>开课时间</th>
<th>适用专业</th>
<th>最大选课人数</th>
<th>是否考试</th>
</tr>
<tr>
<td><input type = "text" name = "course_id" size = "9"></td>
<td><input type = "text" name = "course_name" size = "10"></td>
<td><input type = "text" name = "credit_hour" size = "8"></td>
<td> <input type = "text" name = "course_time" size = "9">
<td><input type = "text" name = "teacher" size = "9"></td>
<td> <select name= select_time>
<option>--请选择--</option>
<option>第一学期</option>
<option>第二学期</option>
<option>第三学期</option>
<option>第四学期</option>
<option>第五学期</option>
<option>第六学期</option>
<option>第七学期</option>
<option>第八学期</option> </td>
<td><input type = "text" name = "by_who" size = "9"></td>
<td><input type = "text" name = "people" size = "15"></td>
<td><select name=exx><option>NO</option>
<option>YES</option> </select></td>
</tr>
</table>
<br>
<center><input type = submit value = "增加课程"/> </center>
</form>
<%
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
con=DriverManager.getConnection("jdbc:mysql://localhost/jsp?user=root&password=123456&useUnicode=true&characterEncoding=iso8859_1");
sql=con.createStatement();
rs=sql.executeQuery("SELECT * FROM course");
//out.print("已选");
//rs=sql.executeQuery("SELECT * FROM course");
out.print("<hr><br><form method=\"post\" action=\"amend.jsp?couid=" + a_courid2 +"\">");
out.print("<Table Border align='center'>");
out.print("<tr><td colspan=10 align= 'center'> 已有课程 </td></tr>");
out.print("<tr>");
out.print("<TH>课程操作");
out.print("<TH>课程号");
out.print("<TH>课程名字");
out.print("<TH>学分");
out.print("<TH>学时");
out.print("<Th>教师");
out.print("<TH>开课学期");
out.print("<TH>使用专业");
out.print("<TH>最大选课人数");
out.print("<TH>是否考试");
out.print("</tr>");
while(rs.next()){
out.print("<TR>");
String temp = rs.getString(1);
out.print("<td><a href = \"remove_course.jsp?course_id=" + temp +"\">删除</a> <a href = \"course_manage.jsp?a_courid=" + temp +"\">修改</a></td>");
if(a_courid2 != null && rs.getString(1).equals(a_courid2))//if(a_courid.equals("null"))
{
out.print("<TD><input type = \"text\" name = \"c_id\" value = " + rs.getString(1) + " size =8></TD>");
out.print("<TD><input type = \"text\" name = \"c_n\" value = " + rs.getString(2) + " size =8></TD>");
out.print("<TD><input type = \"text\" name = \"c_h\" value = " + rs.getString(3) + " size =8></TD>");
out.print("<TD><input type = \"text\" name = \"c_t\" value = " + rs.getString(4) + " size =8></TD>");
out.print("<TD><input type = \"text\" name = \"te\" value = " + rs.getString(5) + " size =8></TD>");
out.print("<TD><select name= s_t><option>请选择</option><option>第一学期</option><option>第二学期</option><option>第三学期</option><option>第四学期</option><option>第四学期</option><option>第六学期</option><option>第七学期</option><option>第八学期</option></TD>");
out.print("<TD><input type = \"text\" name = \"b_w\" value = " + rs.getString(7) + " size =8></TD>");
out.print("<TD><input type = \"text\" name = \"pe\" value = " + rs.getString(8) + " size =8></TD>");
out.print("<TD><select name=ex_am><option>NO</option> <option>YES</option> </select></TD>");
out.print("</TR>");
}
else
{//out.print(rs.getString(1)+a_courid+"1");
out.print("<TD>"+rs.getString(1)+"</TD>");
out.print("<TD>"+rs.getString(2)+"</TD>");
out.print("<TD>"+rs.getString(3)+"</TD>");
out.print("<TD>"+rs.getString(4)+"</TD>");
out.print("<TD>"+rs.getString(5)+"</TD>");
out.print("<TD>"+rs.getString(6)+"</TD>");
out.print("<TD>"+rs.getString(7)+"</TD>");
out.print("<TD>"+rs.getString(8)+"</TD>");
out.print("<TD>"+rs.getString(9)+"</TD>");
out.print("</TR>");
}
}
out.print("</Table><br>");
out.print("<center><input type = submit value = \"确认修改\"/></center>");
out.print("</form>");
}
catch(Exception e)
{
out.print(e.getMessage());
}
%>
</body>
</html>
评论0