xuanxiuke2_0002ejsp_jsp.java
上传用户:top0756
上传日期:2022-08-11
资源大小:6501k
文件大小:12k
源码类别:

Jsp/Servlet

开发平台:

VBScript

  1. import java.sql.*;
  2. import java.util.*;
  3. import proj112.*;
  4. import javax.servlet.*;
  5. import javax.servlet.http.*;
  6. import javax.servlet.jsp.*;
  7. import org.apache.jasper.runtime.*;
  8. public class xuanxiuke2_0002ejsp_jsp extends HttpJspBase {
  9.     // begin [file="/xuanxiuke2.jsp";from=(5,0);to=(5,57)]
  10.     // end
  11.     static {
  12.     }
  13.     public xuanxiuke2_0002ejsp_jsp( ) {
  14.     }
  15.     private static boolean _jspx_inited = false;
  16.     public final void _jspx_init() throws org.apache.jasper.runtime.JspException {
  17.     }
  18.     public void _jspService(HttpServletRequest request, HttpServletResponse  response)
  19.         throws java.io.IOException, ServletException {
  20.         JspFactory _jspxFactory = null;
  21.         PageContext pageContext = null;
  22.         HttpSession session = null;
  23.         ServletContext application = null;
  24.         ServletConfig config = null;
  25.         JspWriter out = null;
  26.         Object page = this;
  27.         String  _value = null;
  28.         try {
  29.             if (_jspx_inited == false) {
  30.                 synchronized (this) {
  31.                     if (_jspx_inited == false) {
  32.                         _jspx_init();
  33.                         _jspx_inited = true;
  34.                     }
  35.                 }
  36.             }
  37.             _jspxFactory = JspFactory.getDefaultFactory();
  38.             response.setContentType("text/html; charset=GBK");
  39.             pageContext = _jspxFactory.getPageContext(this, request, response,
  40.              "", true, 8192, true);
  41.             application = pageContext.getServletContext();
  42.             config = pageContext.getServletConfig();
  43.             session = pageContext.getSession();
  44.             out = pageContext.getOut();
  45.             // HTML // begin [file="/xuanxiuke2.jsp";from=(0,48);to=(1,0)]
  46.                 out.write("rn");
  47.             // end
  48.             // HTML // begin [file="/xuanxiuke2.jsp";from=(1,31);to=(2,0)]
  49.                 out.write("rn");
  50.             // end
  51.             // HTML // begin [file="/xuanxiuke2.jsp";from=(2,27);to=(3,0)]
  52.                 out.write("rn");
  53.             // end
  54.             // HTML // begin [file="/xuanxiuke2.jsp";from=(3,32);to=(4,0)]
  55.                 out.write("rn");
  56.             // end
  57.             // HTML // begin [file="/xuanxiuke2.jsp";from=(4,30);to=(5,0)]
  58.                 out.write("rn");
  59.             // end
  60.             // begin [file="/xuanxiuke2.jsp";from=(5,0);to=(5,57)]
  61.                 proj112.dbconn a = null;
  62.                 boolean _jspx_speciala  = false;
  63.                  synchronized (pageContext) {
  64.                     a= (proj112.dbconn)
  65.                     pageContext.getAttribute("a",PageContext.PAGE_SCOPE);
  66.                     if ( a == null ) {
  67.                         _jspx_speciala = true;
  68.                         try {
  69.                             a = (proj112.dbconn) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "proj112.dbconn");
  70.                         } catch (ClassNotFoundException exc) {
  71.                              throw new InstantiationException(exc.getMessage());
  72.                         } catch (Exception exc) {
  73.                              throw new ServletException (" Cannot create bean of class "+"proj112.dbconn", exc);
  74.                         }
  75.                         pageContext.setAttribute("a", a, PageContext.PAGE_SCOPE);
  76.                     }
  77.                  } 
  78.                 if(_jspx_speciala == true) {
  79.             // end
  80.             // begin [file="/xuanxiuke2.jsp";from=(5,0);to=(5,57)]
  81.                 }
  82.             // end
  83.             // HTML // begin [file="/xuanxiuke2.jsp";from=(5,57);to=(13,3)]
  84.                 out.write("rn<html>rn<head>rn<title>rnxuanke_1rn</title>rn</head>rn<body bgcolor="#ffffff">rn   ");
  85.             // end
  86.             // begin [file="/xuanxiuke2.jsp";from=(13,5);to=(25,5)]
  87.                 
  88.                        String kechenghao=request.getParameter("kechenghao");
  89.                        int totalrecord = 0;
  90.                        String sql="";
  91.                        String sql1="";
  92.                        String sql2="";
  93.                        String name="";
  94.                        sql="SELECT * FROM kecheng where kch='"+kechenghao+"'";
  95.                        ResultSet rs=a.executeQuery(sql);
  96.                  if(rs.next())
  97.                    {
  98.                      name=rs.getString("kcm");
  99.                      
  100.             // end
  101.             // HTML // begin [file="/xuanxiuke2.jsp";from=(25,7);to=(26,32)]
  102.                 out.write("rn     <br> 课程号:<font color="red">");
  103.             // end
  104.             // begin [file="/xuanxiuke2.jsp";from=(26,35);to=(26,46)]
  105.                 out.print(kechenghao );
  106.             // end
  107.             // HTML // begin [file="/xuanxiuke2.jsp";from=(26,48);to=(26,90)]
  108.                 out.write("</font>&nbsp;&nbsp; 课程名:<font color="red">");
  109.             // end
  110.             // begin [file="/xuanxiuke2.jsp";from=(26,93);to=(26,98)]
  111.                 out.print(name );
  112.             // end
  113.             // HTML // begin [file="/xuanxiuke2.jsp";from=(26,100);to=(27,5)]
  114.                 out.write("</font>,选修该课程的学生如下:<br><br><hr><br>rn     ");
  115.             // end
  116.             // begin [file="/xuanxiuke2.jsp";from=(27,7);to=(35,9)]
  117.                   sql1 = "SELECT count(*) as recordcount FROM 选课关联 where kch='"+kechenghao+"'";
  118.                      ResultSet bs = a.executeQuery(sql1);
  119.                      if (bs.next())
  120.                      {
  121.                        totalrecord = bs.getInt("recordcount");
  122.                        if(totalrecord!=0){
  123.                          sql2="SELECT * FROM 选课关联,student where 选课关联.stu_id=student.stu_id and 选课关联.kch='"+kechenghao+"'";
  124.                          ResultSet ts=a.executeQuery(sql2);
  125.                          
  126.             // end
  127.             // HTML // begin [file="/xuanxiuke2.jsp";from=(35,11);to=(46,13)]
  128.                 out.write("rn         <p align="center">rn<table  width="100%" cellspacing="0" cellpadding="4" rules="all" bordercolor="#CC9966" border="1" id="dg_rxkb" style="background-color:White;border-color:#CC9966;border-width:1px;border-style:None;width:100%;border-collapse:collapse;">rn             <tr>rn               <td align="center"><font color="#6633CC">姓名</font></td>rn               <td align="center"><font color="#6633CC">学号</font></td>rn               <td align="center"><font color="#6633CC">性别</font></td>rn               <td align="center"><font color="#6633CC">专业</font></td>rn               <td align="center"><font color="#6633CC">民族</font></td>rn               <td align="center"><font color="#6633CC">政治面貌</font></td>rn             </tr>rn             ");
  129.             // end
  130.             // begin [file="/xuanxiuke2.jsp";from=(46,15);to=(47,30)]
  131.                 
  132.                              while(ts.next()){
  133.             // end
  134.             // HTML // begin [file="/xuanxiuke2.jsp";from=(47,32);to=(49,34)]
  135.                 out.write("rn             <tr>rn               <td align="center">");
  136.             // end
  137.             // begin [file="/xuanxiuke2.jsp";from=(49,37);to=(49,52)]
  138.                 out.print(ts.getString(4));
  139.             // end
  140.             // HTML // begin [file="/xuanxiuke2.jsp";from=(49,54);to=(50,34)]
  141.                 out.write("</td>rn               <td align="center">");
  142.             // end
  143.             // begin [file="/xuanxiuke2.jsp";from=(50,37);to=(50,52)]
  144.                 out.print(ts.getString(5));
  145.             // end
  146.             // HTML // begin [file="/xuanxiuke2.jsp";from=(50,54);to=(51,34)]
  147.                 out.write("</td>rn               <td align="center">");
  148.             // end
  149.             // begin [file="/xuanxiuke2.jsp";from=(51,37);to=(51,52)]
  150.                 out.print(ts.getString(7));
  151.             // end
  152.             // HTML // begin [file="/xuanxiuke2.jsp";from=(51,54);to=(52,34)]
  153.                 out.write("</td>rn               <td align="center">");
  154.             // end
  155.             // begin [file="/xuanxiuke2.jsp";from=(52,37);to=(52,52)]
  156.                 out.print(ts.getString(8));
  157.             // end
  158.             // HTML // begin [file="/xuanxiuke2.jsp";from=(52,54);to=(53,34)]
  159.                 out.write("</td>rn               <td align="center">");
  160.             // end
  161.             // begin [file="/xuanxiuke2.jsp";from=(53,37);to=(53,52)]
  162.                 out.print(ts.getString(9));
  163.             // end
  164.             // HTML // begin [file="/xuanxiuke2.jsp";from=(53,54);to=(54,34)]
  165.                 out.write("</td>rn               <td align="center">");
  166.             // end
  167.             // begin [file="/xuanxiuke2.jsp";from=(54,37);to=(54,53)]
  168.                 out.print(ts.getString(10));
  169.             // end
  170.             // HTML // begin [file="/xuanxiuke2.jsp";from=(54,55);to=(56,13)]
  171.                 out.write("</td>rn             </tr>rn             ");
  172.             // end
  173.             // begin [file="/xuanxiuke2.jsp";from=(56,15);to=(56,17)]
  174.                 } 
  175.             // end
  176.             // HTML // begin [file="/xuanxiuke2.jsp";from=(56,19);to=(59,59)]
  177.                 out.write("rn           </table><br >rn         <center>rn           选修该课程的人数为:&nbsp;&nbsp;<input type="text" value="");
  178.             // end
  179.             // begin [file="/xuanxiuke2.jsp";from=(59,62);to=(59,73)]
  180.                 out.print(totalrecord);
  181.             // end
  182.             // HTML // begin [file="/xuanxiuke2.jsp";from=(59,75);to=(61,11)]
  183.                 out.write("" size="2" align="right" readonly="readonly">&nbsp;人rn         </center>rn           ");
  184.             // end
  185.             // begin [file="/xuanxiuke2.jsp";from=(61,13);to=(62,12)]
  186.                 }else
  187.                            {
  188.             // end
  189.             // HTML // begin [file="/xuanxiuke2.jsp";from=(62,14);to=(68,11)]
  190.                 out.write("rn           <script language="javascript">rn           alert("没有选修这门课程的学生");rn           history.go(-1);rn           history.go(0);rn           </script>rn           ");
  191.             // end
  192.             // begin [file="/xuanxiuke2.jsp";from=(68,13);to=(70,12)]
  193.                 }
  194.                            }else
  195.                            {
  196.             // end
  197.             // HTML // begin [file="/xuanxiuke2.jsp";from=(70,14);to=(76,11)]
  198.                 out.write("rn           <script language="javascript">rn           alert("没有选修这门课程的学生");rn           history.go(-1);rn           history.go(0);rn           </script>rn           ");
  199.             // end
  200.             // begin [file="/xuanxiuke2.jsp";from=(76,13);to=(79,6)]
  201.                 }
  202.                            }
  203.                    else
  204.                      {
  205.             // end
  206.             // HTML // begin [file="/xuanxiuke2.jsp";from=(79,8);to=(85,3)]
  207.                 out.write("rn     <script language="javascript">rn     alert("没有你输入的课程号,请重新输入");rn     history.go(-1);rn     history.go(0);rn     </script>rn   ");
  208.             // end
  209.             // begin [file="/xuanxiuke2.jsp";from=(85,5);to=(86,6)]
  210.                 }
  211.                       
  212.             // end
  213.             // HTML // begin [file="/xuanxiuke2.jsp";from=(86,8);to=(96,0)]
  214.                 out.write("rnrn<br><br><br><br>rn  <center><a href="xuanxiuke.jsp">返回</a></center>rnrnrnrn</body>rnrn</html>rn");
  215.             // end
  216.         } catch (Throwable t) {
  217.             if (out != null && out.getBufferSize() != 0)
  218.                 out.clearBuffer();
  219.             if (pageContext != null) pageContext.handlePageException(t);
  220.         } finally {
  221.             if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
  222.         }
  223.     }
  224. }