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

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 chakan2_0002ejsp_jsp extends HttpJspBase {
  9.     // begin [file="/chakan2.jsp";from=(5,0);to=(5,57)]
  10.     // end
  11.     static {
  12.     }
  13.     public chakan2_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="/chakan2.jsp";from=(0,48);to=(1,0)]
  46.                 out.write("rn");
  47.             // end
  48.             // HTML // begin [file="/chakan2.jsp";from=(1,31);to=(2,0)]
  49.                 out.write("rn");
  50.             // end
  51.             // HTML // begin [file="/chakan2.jsp";from=(2,27);to=(3,0)]
  52.                 out.write("rn");
  53.             // end
  54.             // HTML // begin [file="/chakan2.jsp";from=(3,32);to=(4,0)]
  55.                 out.write("rn");
  56.             // end
  57.             // HTML // begin [file="/chakan2.jsp";from=(4,30);to=(5,0)]
  58.                 out.write("rn");
  59.             // end
  60.             // begin [file="/chakan2.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="/chakan2.jsp";from=(5,0);to=(5,57)]
  81.                 }
  82.             // end
  83.             // HTML // begin [file="/chakan2.jsp";from=(5,57);to=(13,3)]
  84.                 out.write("rn<html>rn<head>rn<title>rnchakan1_2rn</title>rn</head>rn<body bgcolor="#ffffff">rn   ");
  85.             // end
  86.             // begin [file="/chakan2.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 chengji 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="/chakan2.jsp";from=(25,7);to=(26,32)]
  102.                 out.write("rn     <br> 课程号:<font color="red">");
  103.             // end
  104.             // begin [file="/chakan2.jsp";from=(26,35);to=(26,46)]
  105.                 out.print(kechenghao );
  106.             // end
  107.             // HTML // begin [file="/chakan2.jsp";from=(26,48);to=(26,90)]
  108.                 out.write("</font>&nbsp;&nbsp; 课程名:<font color="red">");
  109.             // end
  110.             // begin [file="/chakan2.jsp";from=(26,93);to=(26,98)]
  111.                 out.print(name );
  112.             // end
  113.             // HTML // begin [file="/chakan2.jsp";from=(26,100);to=(27,5)]
  114.                 out.write("</font>,选修该课学生成绩如下:<br><br><hr><br><br>rn     ");
  115.             // end
  116.             // begin [file="/chakan2.jsp";from=(27,7);to=(35,9)]
  117.                   sql1 = "SELECT count(*) as recordcount FROM 成绩关联 where 课程号='"+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 student.stu_id=成绩关联.stu_id and 成绩关联.课程号='"+kechenghao+"'";
  124.                          ResultSet ts=a.executeQuery(sql2);
  125.                          
  126.             // end
  127.             // HTML // begin [file="/chakan2.jsp";from=(35,11);to=(45,13)]
  128.                 out.write("rn         <p align="center">rn      <table  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             </tr>rn             ");
  129.             // end
  130.             // begin [file="/chakan2.jsp";from=(45,15);to=(46,30)]
  131.                 
  132.                              while(ts.next()){
  133.             // end
  134.             // HTML // begin [file="/chakan2.jsp";from=(46,32);to=(48,34)]
  135.                 out.write("rn             <tr>rn               <td align="center">");
  136.             // end
  137.             // begin [file="/chakan2.jsp";from=(48,37);to=(48,52)]
  138.                 out.print(ts.getString(1));
  139.             // end
  140.             // HTML // begin [file="/chakan2.jsp";from=(48,54);to=(49,34)]
  141.                 out.write("</td>rn               <td align="center">");
  142.             // end
  143.             // begin [file="/chakan2.jsp";from=(49,37);to=(49,52)]
  144.                 out.print(ts.getString(2));
  145.             // end
  146.             // HTML // begin [file="/chakan2.jsp";from=(49,54);to=(50,34)]
  147.                 out.write("</td>rn               <td align="center">");
  148.             // end
  149.             // begin [file="/chakan2.jsp";from=(50,37);to=(50,52)]
  150.                 out.print(ts.getString(4));
  151.             // end
  152.             // HTML // begin [file="/chakan2.jsp";from=(50,54);to=(51,34)]
  153.                 out.write("</td>rn               <td align="center">");
  154.             // end
  155.             // begin [file="/chakan2.jsp";from=(51,37);to=(51,53)]
  156.                 out.print(ts.getString(24));
  157.             // end
  158.             // HTML // begin [file="/chakan2.jsp";from=(51,55);to=(52,34)]
  159.                 out.write("</td>rn               <td align="center">");
  160.             // end
  161.             // begin [file="/chakan2.jsp";from=(52,37);to=(52,53)]
  162.                 out.print(ts.getString(25));
  163.             // end
  164.             // HTML // begin [file="/chakan2.jsp";from=(52,55);to=(54,13)]
  165.                 out.write("</td>rn             </tr>rn             ");
  166.             // end
  167.             // begin [file="/chakan2.jsp";from=(54,15);to=(54,17)]
  168.                 } 
  169.             // end
  170.             // HTML // begin [file="/chakan2.jsp";from=(54,19);to=(57,61)]
  171.                 out.write("rn           </table><br >rn         <center>rn           该基础课有成绩的人数为:&nbsp;&nbsp;<input type="text" value="");
  172.             // end
  173.             // begin [file="/chakan2.jsp";from=(57,64);to=(57,75)]
  174.                 out.print(totalrecord);
  175.             // end
  176.             // HTML // begin [file="/chakan2.jsp";from=(57,77);to=(59,11)]
  177.                 out.write("" size="2" align="right" readonly="readonly">&nbsp;人rn         </center>rn           ");
  178.             // end
  179.             // begin [file="/chakan2.jsp";from=(59,13);to=(60,12)]
  180.                 }else
  181.                            {
  182.             // end
  183.             // HTML // begin [file="/chakan2.jsp";from=(60,14);to=(66,11)]
  184.                 out.write("rn           <script language="javascript">rn           alert("没有选修这门课程的学生");rn           history.go(-1);rn           history.go(0);rn           </script>rn           ");
  185.             // end
  186.             // begin [file="/chakan2.jsp";from=(66,13);to=(68,12)]
  187.                 }
  188.                            }else
  189.                            {
  190.             // end
  191.             // HTML // begin [file="/chakan2.jsp";from=(68,14);to=(74,11)]
  192.                 out.write("rn           <script language="javascript">rn           alert("没有选修这门课程的学生");rn           history.go(-1);rn           history.go(0);rn           </script>rn           ");
  193.             // end
  194.             // begin [file="/chakan2.jsp";from=(74,13);to=(77,6)]
  195.                 }
  196.                            }
  197.                    else
  198.                      {
  199.             // end
  200.             // HTML // begin [file="/chakan2.jsp";from=(77,8);to=(83,3)]
  201.                 out.write("rn     <script language="javascript">rn     alert("没有你输入的课程号,请重新输入");rn     history.go(-1);rn     history.go(0);rn     </script>rn   ");
  202.             // end
  203.             // begin [file="/chakan2.jsp";from=(83,5);to=(84,6)]
  204.                 }
  205.                       
  206.             // end
  207.             // HTML // begin [file="/chakan2.jsp";from=(84,8);to=(92,0)]
  208.                 out.write("rnrnrnrnrn</body>rnrnrn");
  209.             // end
  210.         } catch (Throwable t) {
  211.             if (out != null && out.getBufferSize() != 0)
  212.                 out.clearBuffer();
  213.             if (pageContext != null) pageContext.handlePageException(t);
  214.         } finally {
  215.             if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
  216.         }
  217.     }
  218. }