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

Jsp/Servlet

开发平台:

VBScript

  1. import java.sql.*;
  2. import javax.servlet.*;
  3. import javax.servlet.http.*;
  4. import javax.servlet.jsp.*;
  5. import org.apache.jasper.runtime.*;
  6. public class searchscore_0002ejsp_jsp extends HttpJspBase {
  7.     static {
  8.     }
  9.     public searchscore_0002ejsp_jsp( ) {
  10.     }
  11.     private static boolean _jspx_inited = false;
  12.     public final void _jspx_init() throws org.apache.jasper.runtime.JspException {
  13.     }
  14.     public void _jspService(HttpServletRequest request, HttpServletResponse  response)
  15.         throws java.io.IOException, ServletException {
  16.         JspFactory _jspxFactory = null;
  17.         PageContext pageContext = null;
  18.         HttpSession session = null;
  19.         ServletContext application = null;
  20.         ServletConfig config = null;
  21.         JspWriter out = null;
  22.         Object page = this;
  23.         String  _value = null;
  24.         try {
  25.             if (_jspx_inited == false) {
  26.                 synchronized (this) {
  27.                     if (_jspx_inited == false) {
  28.                         _jspx_init();
  29.                         _jspx_inited = true;
  30.                     }
  31.                 }
  32.             }
  33.             _jspxFactory = JspFactory.getDefaultFactory();
  34.             response.setContentType("text/html;charset=gb2312");
  35.             pageContext = _jspxFactory.getPageContext(this, request, response,
  36.              "", true, 8192, true);
  37.             application = pageContext.getServletContext();
  38.             config = pageContext.getServletConfig();
  39.             session = pageContext.getSession();
  40.             out = pageContext.getOut();
  41.             // HTML // begin [file="/searchscore.jsp";from=(0,48);to=(1,0)]
  42.                 out.write("rn");
  43.             // end
  44.             // HTML // begin [file="/searchscore.jsp";from=(1,29);to=(17,0)]
  45.                 out.write("rn<HTML>rn  <head><SCRIPT language="JavaScript">rnfunction a() {rnrntif(form1.keywords.value==""){rnttalert("用户名不能为空,请确定后重新输入");rnttform1.keywords.focus();rnttreturn false;rnt}rnrntreturn true;rn}</script>rn</head>rn  <BODY  background="img/main_5.jpg"><br>rnrn");
  46.             // end
  47.             // begin [file="/searchscore.jsp";from=(17,2);to=(64,0)]
  48.                 
  49.                 Connection conn = null;
  50.                 Statement stmt = null;
  51.                 ResultSet rs = null;
  52.                 try{
  53.                  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  54.                 }
  55.                 catch(ClassNotFoundException ce){
  56.                  out.println(ce.getMessage());
  57.                 }
  58.                 request.setCharacterEncoding("GBK");
  59.                 String str = request.getParameter("keywords");
  60.                 if( str == null)
  61.                  str = "";
  62.                       else
  63.                 try{
  64.                  conn=DriverManager.getConnection("jdbc:odbc:dsn112");
  65.                  stmt=conn.createStatement();
  66.                         rs=stmt.executeQuery("SELECT * FROM stu001 WHERE stu_id LIKE '%" + str + "%'");
  67.                         out.print("<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:99%;border-collapse:collapse;'>");
  68.                          out.print("<tr bgcolor='EcEcff' align='center'><TD>学期号</TD>");
  69.                        out.print("<TD>课程号</TD>");
  70.                  out.print("<TD>课程名</TD>");
  71.                                 out.print("<TD>学分</TD>");
  72.                                 out.print("<TD>成绩</TD>");
  73.                                 out.print("<TD>重修成绩</TD>");
  74.                        out.print("<TD>主讲老师</TD></TR>");
  75.                  while(rs.next()){
  76.                  out.print("<tr align='center'><TD>"+rs.getString("xq_id")+"</TD>");
  77.                  out.print("<TD>"+rs.getString("co_id")+"</TD>");
  78.                  out.print("<TD>"+rs.getString("co_name")+"</TD>");
  79.                  out.print("<TD>"+rs.getString("credit_hour")+"</TD>");
  80.                                 out.print("<TD>"+rs.getString("cj")+"</TD>");
  81.                                  out.print("<TD>"+rs.getString("cxcj")+"</TD>");
  82.                  out.print("<TD>"+rs.getString("teacher")+"</TD></TR>");
  83.                  }
  84.                  out.print("</TABLE>");
  85.                 
  86.                 }
  87.                 catch(SQLException e){
  88.                  System.out.println(e.getMessage());
  89.                 }
  90.                 finally{
  91.                  stmt.close();
  92.                  conn.close();
  93.                 }
  94.                 
  95.             // end
  96.             // HTML // begin [file="/searchscore.jsp";from=(64,2);to=(73,46)]
  97.                 out.write("rnrn <FORM name="form1" Action="" Method="POST">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:99%;border-collapse:collapse;">rnrn<tr >rn      <td bgcolor="#EcEcff" colspan="2"><div align="center" ><font  size="5" >查找成绩</strong></font></div></td>rn    </tr>rn<tr ><td>请输入你的学号:</td>rn<td><INPUT Type="Text" Name="keywords" Value="");
  98.             // end
  99.             // begin [file="/searchscore.jsp";from=(73,49);to=(73,52)]
  100.                 out.print(str);
  101.             // end
  102.             // HTML // begin [file="/searchscore.jsp";from=(73,54);to=(77,0)]
  103.                 out.write(""></td></tr>rn<tr ><td  height="35" colspan="2"><div align="center"><INPUT Type=Submit Value=" 查找" onClick="return a()" ></td></tr></table>rn</FORM>rn</BODY></HTML>rn");
  104.             // end
  105.         } catch (Throwable t) {
  106.             if (out != null && out.getBufferSize() != 0)
  107.                 out.clearBuffer();
  108.             if (pageContext != null) pageContext.handlePageException(t);
  109.         } finally {
  110.             if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
  111.         }
  112.     }
  113. }