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

📄 xuanke_manage.jsp

📁 选课系统能够实现选课功能
💻 JSP
字号:
<%@ page contentType="text/html; charset=iso8859_1" language="java" import="java.sql.*" errorPage="" %>
<html >
<head>
<title>无标题文档</title>
</head>
<script>   
function   doJsp(value){   
	self.location="xuanke_manage.jsp?gread=" + value;   
}   
function   doJsp2(value_gra,value_cour){   
	self.location="xuanke_manage.jsp?gread=" + value_gra +"&ccourse=" +value_cour;   
} 
</SCRIPT>   

<body background="jpg/4.jpg">
<br>
<br>
<form     name=form1>       <a>              课程学期:</a>
<select     name=grade     onchange="doJsp(this.value)">     
<%
String term = request.getParameter("gread"); 
String ccourse = request.getParameter("ccourse"); 
if(term ==null) out.print("<option>--请选择学期--</option>");
else
{
out.print("<option value =" +term +">" + term+"</option>");
}
%>
<option value = 第一学期>第一学期</option>  
<option value = 第二学期>第二学期</option>
<option value = 第三学期>第三学期</option>
<option value = 第四学期>第四学期</option>
<option value = 第五学期>第五学期</option>
<option value = 第六学期>第六学期</option>
<option value = 第七学期>第七学期</option>
<option value = 第八学期>第八学期</option>     
</select>       

</form>
  <form     name=form2>  <a>              课程名称:</a>
<select     name=ccourse onchange="doJsp2(form1.grade.value,form2.ccourse.value)">       
<%if(ccourse ==null) out.print("<option>--请选择课程--</option>");
else
{
out.print("<option value =" + ccourse +">" + ccourse+"</option>");
}
%>       
 <p>

<%

if(term != null)
{
	Connection con; 
	Statement sql; 
	ResultSet rs;  
		con=DriverManager.getConnection("jdbc:mysql://localhost/jsp?user=root&password=123456&useUnicode=true&characterEncoding=iso8859_1");  
		sql=con.createStatement(); 
		// out.print(course_i+"pppp");//    
		rs = sql.executeQuery("select course_name from course where start_term ='" + term +"'"); 
		while(rs.next())
		{
%>
		<option value = <%=rs.getString(1)%>> <%= rs.getString(1)%> </option>




<%
		}
%>
 </select></form> 
	<Table Border align=center> 
	<tr><td colspan=6 align= 'center'> 已有课程 </td></tr>
	<tr>
	<th width=100>删除学生
	<TH width=100>学号 
	<TH width=100>姓名 
	<TH width=100>课程名称 
	<TH width=100>是否考试
	<TH width=100>成绩
	</TR> 
<%
if(ccourse!=null)
{
rs=sql.executeQuery(" select a.student_id,student_name,course_name,exam,result,b.course_id from student a,course b,choice_course c where a.student_id = c.student_id   and b.course_id = c.course_id and b.course_name='" +ccourse+"' and b.start_term='" +term+ "' "); 
while(rs.next())
{
	out.print("<TR>");
	out.print("<td><a href = \"remove_student.jsp?student_id=" + rs.getString(1) +"&course_id=" + rs.getString(6)+ "&term1=" + term +"&ccourse=" + ccourse +"\">删除</a></td>"); 
	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("</tr>");
}
}


}
else
{
out.print(" </select></form><Table Border align = center>"); 
	out.print("<tr><td colspan=6 align= 'center'> 已有课程 </td></tr>");
	out.print("<tr>"); 
	out.print("<th width=100>" +"删除学生");
	out.print("<TH width=100>"+"学号"); 
	out.print("<TH width=100>"+"姓名"); 
	out.print("<TH width=100>"+"课程名称"); 
	out.print("<TH width=100>"+"是否考试"); 
	out.print("<TH width=100>"+"成绩"); 
	out.print("</TR>"); 
}
%>

  

</body>
</html>





⌨️ 快捷键说明

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