⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selectcourse.jsp

📁 网上选课系统
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<style type="text/css">
<!--
body {
	background-image: url(images/surface.jpg);
}
-->
</style></head>
<body>
<form name="form1" >
<%!
	String accountID ="";
	int C_ID;
%>
<%		
	if(session.isNew())		response.sendRedirect("Index.jsp");
	else	
	{
		Object id = session.getAttribute("id");
		accountID = id.toString();
	}
%>
<jsp:useBean id="show" class="student.CourseRead" />
<jsp:setProperty name="show" property="sid" value="<%=accountID %>" />
<jsp:setProperty name="show" property="semester" value="2007年秋" />
<%	
    ResultSet result=show.getCourse();
	out.println("<table border = '0' >");
	out.println("<tr>"+"<th>请选择</th><th>课程号</th><th>课程名</th><th>任课老师</th><th>学分</th><th>学时</th><th>最大人数</th>");
	while(result.next())
	{	
		C_ID=result.getInt(1);
		out.println("<tr><td><input type=\"checkbox\" name=\"course\" value=\""+String.valueOf(C_ID)+"\" /></td><td>"+C_ID+"</td><td>"+result.getString(2)+"</td><td>"+result.getString(5)+"</td><td>"+result.getFloat(3)+"</td><td>"+result.getInt(4)+"</td><td>"+result.getString(8)+"</td><td>");
	}
	show.Close();
%>
<tr><td></td><td></td><td></td><td><input type="submit" name="submit" value="选课"></td><td></td><td></td><td></td><td></tr>
</table>
</form>
<%  
	   if(request.getParameter("choice") != null)
	   {
%>
<jsp:useBean id="delete1" class="student.DeleteCourse" />
<jsp:setProperty name="delete1" property="semester" value="2007年秋" />
<jsp:setProperty name="delete1" property="SID" value="<%=accountID %>"/>
<jsp:setProperty name="delete1" property="ID" param="choice"/>
<%
	    int dl=delete1.getDelete();
        delete1.Close();
	   }
%>
<form>
<hr>	
<% 
   if(request.getParameter("course") != null)
	{
%>
<jsp:useBean id="select1" class="student.ShowSelectCourse"/>
<jsp:setProperty name="select1" property="ID" param="course"/>
<jsp:setProperty name="select1" property="semester" value="2007年秋"/>	
<jsp:setProperty name="select1" property="SID" value="<%=accountID %>" />
<%			
		out.println("选课结果:");
		out.println("<table>");
		ResultSet result1=select1.getSelect();
		out.println("<tr>"+"<th>请选择</th><th>课程号</th><th>课程名</th><th>任课老师</th><th>学分</th><th>学时</th><th>最大人数</th>");
	      while(result1.next())
		  {
		    C_ID=result1.getInt(1);
		    out.println("<tr><td><input type=\"checkbox\" name=\"choice\" value=\""+C_ID+"\" /></td><td>"+C_ID+"</td><td>"+result1.getString(2)+"</td><td>"+result1.getString(5)+"</td><td>"+result1.getFloat(3)+"</td><td>"+result1.getInt(4)+"</td><td>"+result1.getString(8)+"</td><td>");
		   }
		   select1.Close();
    }
	else
	{
%>
<jsp:useBean id="get1" class="student.GetCourse" />
<jsp:setProperty name="get1" property="semester" value="2007年秋" />
<jsp:setProperty name="get1" property="SID" value="<%=accountID %>"/>	
<%		
		out.println("选课结果:");
		out.println("<table>");
		ResultSet result2=get1.getSelect();
		out.println("<tr>"+"<th>请选择</th><th>课程号</th><th>课程名</th><th>任课老师</th><th>学分</th><th>学时</th><th>最大人数</th>");
	      while(result2.next())
		  {
		   C_ID=result2.getInt(1);
		    out.println("<tr><td><input type=\"checkbox\" name=\"choice\" value=\""+C_ID+"\" /></td><td>"+C_ID+"</td><td>"+result2.getString(2)+"</td><td>"+result2.getString(5)+"</td><td>"+result2.getFloat(3)+"</td><td>"+result2.getInt(4)+"</td><td>"+result2.getString(8)+"</td><td>");
		  }
		  get1.Close();
	 }
%>
	<tr><td></td><td></td><td></td><td><input type="submit" name="submit" value="删除"></td><td></td><td></td><td></td><td></tr>
</table> 
</form> 
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -