xuanxiuke1.jsp~6~
资源名称:JSP02.rar [点击查看]
上传用户:top0756
上传日期:2022-08-11
资源大小:6501k
文件大小:3k
源码类别:
Jsp/Servlet
开发平台:
VBScript
- <%@ page contentType="text/html; charset=GBK" %>
- <%@ page import="java.sql.*" %>
- <%@ page language="java" %>
- <%@ page import="java.util.*" %>
- <%@ page import="proj112.*" %>
- <jsp:useBean id="a" scope="page" class="proj112.dbconn"/>
- <html>
- <head>
- <title>
- xuanke_1
- </title>
- </head>
- <body bgcolor="#ffffff">
- <%
- String stu_id=request.getParameter("stu_id");
- int totalrecord = 0;
- String sql="";
- String sql1="";
- String sql2="";
- String name="";
- sql="SELECT * FROM student where stu_id='"+stu_id+"'";
- ResultSet rs=a.executeQuery(sql);
- if(rs.next())
- {
- name=rs.getString("stu_name");
- %>
- <br> 学号:<%=stu_id %> 姓名:<%=name %>,所选修的课程如下:<br><br><hr><br><br>
- <% sql1 = "SELECT count(*) as recordcount FROM 选课关联 where stu_id='"+stu_id+"'";
- ResultSet bs = a.executeQuery(sql1);
- if (bs.next())
- {
- totalrecord = bs.getInt("recordcount");
- if(totalrecord!=0){
- sql2="SELECT * FROM 选课关联,kechengbiao where 选课关联.kch=kechengbiao.kch and 选课关联.stu_id='"+stu_id+"'";
- ResultSet ts=a.executeQuery(sql2);
- %>
- <p align="center">
- <table width="500" cellpadding=3 cellspacing=0 align=center border=1 bordercolor="#FFCCCC" >
- <tr>
- <td align="center"><font color="#6633CC">课程号</font></td>
- <td align="center"><font color="#6633CC">课程名</font></td>
- <td align="center"><font color="#6633CC">任课教师</font></td>
- <td align="center"><font color="#6633CC">周几</font></td>
- <td align="center"><font color="#6633CC">时间</font></td>
- <td align="center"><font color="#6633CC">上课教室</font></td>
- </tr>
- <%
- while(ts.next()){%>
- <tr>
- <td align="center"><%=ts.getString("1")%></td>
- <td align="center"><%=ts.getString("2")%></td>
- <td align="center"><%=ts.getString("3")%></td>
- <td align="center"><%=ts.getString("4")%></td>
- <td align="center"><%=ts.getString("5")%></td>
- <td align="center"><%=ts.getString("6")%></td>
- </tr>
- <%} %>
- </table>
- <%}else
- {%>
- <script language="javascript">
- alert("该学生没有选课");
- history.go(-1);
- history.go(0);
- </script>
- <%}
- }else
- {%>
- <script language="javascript">
- alert("该学生没有选课");
- history.go(-1);
- history.go(0);
- </script>
- <%}
- }
- else
- {%>
- <script language="javascript">
- alert("没有你输入的学生,请重新输入");
- history.go(-1);
- history.go(0);
- </script>
- <%}
- %>
- </body>