kecheng1_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 kecheng1_0002ejsp_jsp extends HttpJspBase {
  9.     // begin [file="/kecheng1.jsp";from=(5,0);to=(5,57)]
  10.     // end
  11.     static {
  12.     }
  13.     public kecheng1_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="/kecheng1.jsp";from=(0,48);to=(1,0)]
  46.                 out.write("rn");
  47.             // end
  48.             // HTML // begin [file="/kecheng1.jsp";from=(1,31);to=(2,0)]
  49.                 out.write("rn");
  50.             // end
  51.             // HTML // begin [file="/kecheng1.jsp";from=(2,27);to=(3,0)]
  52.                 out.write("rn");
  53.             // end
  54.             // HTML // begin [file="/kecheng1.jsp";from=(3,32);to=(4,0)]
  55.                 out.write("rn");
  56.             // end
  57.             // HTML // begin [file="/kecheng1.jsp";from=(4,30);to=(5,0)]
  58.                 out.write("rn");
  59.             // end
  60.             // begin [file="/kecheng1.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="/kecheng1.jsp";from=(5,0);to=(5,57)]
  81.                 }
  82.             // end
  83.             // HTML // begin [file="/kecheng1.jsp";from=(5,57);to=(17,51)]
  84.                 out.write("rn<html>rn<head>rn  <style type="TEXT/CSS">rn  A:LINK{COLOR:blue;FONT-SIZE:11PT;TEXT-DECORATION:NONE}rn  A:VISITED{COLOR:blue;FONT-SIZE:11PT;TEXT-DECORATION:NONE}rn   A:HOVER{COLOR:red;FONT-SIZE:11PT;TEXT-DECORATION:UNDERLINE}</STYLE>rn<title>rnkecheng1rn</title>rn</head>rn<body bgcolor="#ffffff"><br>rn&nbsp; &nbsp; &nbsp;姓名:&nbsp;<font color="#0033FF">");
  85.             // end
  86.             // begin [file="/kecheng1.jsp";from=(17,54);to=(17,87)]
  87.                 out.print(session.getAttribute("stu_name") );
  88.             // end
  89.             // HTML // begin [file="/kecheng1.jsp";from=(17,89);to=(17,150)]
  90.                 out.write(" </font>  &nbsp; &nbsp; &nbsp;学号:&nbsp;<font color="#0033FF">");
  91.             // end
  92.             // begin [file="/kecheng1.jsp";from=(17,153);to=(17,180)]
  93.                 out.print(session.getAttribute("id") );
  94.             // end
  95.             // HTML // begin [file="/kecheng1.jsp";from=(17,182);to=(19,0)]
  96.                 out.write("</font><br>rn <hr><br>rn");
  97.             // end
  98.             // begin [file="/kecheng1.jsp";from=(19,2);to=(37,0)]
  99.                 
  100.                 int PageSize = 6;
  101.                 int Page = 1;
  102.                 int totalPage = 1;
  103.                 int totalrecord = 0;
  104.                 String id = "";
  105.                 
  106.                 String sql = null;
  107.                 ResultSet rs = null;
  108.                 
  109.                 
  110.                     //算出总行数
  111.                  sql = "SELECT count(*) as recordcount FROM kecheng";
  112.                  rs = a.executeQuery(sql);
  113.                  if (rs.next()) totalrecord = rs.getInt("recordcount");
  114.                  //输出记录
  115.                  sql = "SELECT * FROM kecheng";
  116.                     rs = a.executeQuery(sql);
  117.             // end
  118.             // HTML // begin [file="/kecheng1.jsp";from=(37,2);to=(56,0)]
  119.                 out.write("rn<form action="kecheng2.jsp" method="POST" name="form3">rnrn<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 align=middle>rn    <td colspan="7" bgcolor="#9dcaf4"><font color="red">所有课程信息</font></td>rn  </tr>rn   <tr>rn        <td align="center"><font color="#6633CC">选课</font></td>rn        <td align="center"><font color="#6633CC">课程号</font></td>rnt<td align="center"><font color="#6633CC">课程名</font></td>rnt<td align="center"><font color="#6633CC">任课教师</font></td>rnt<td align="center"><font color="#6633CC">星期几</font></td>rnt<td align="center"><font color="#6633CC">时间</font></td>rnt<td align="center"><font color="#6633CC">上课教室</font></td>rnrn    </tr>rnrn");
  120.             // end
  121.             // begin [file="/kecheng1.jsp";from=(56,2);to=(74,39)]
  122.                 
  123.                 if(totalrecord % PageSize ==0)// 如果是当前页码的整数倍
  124.                  totalPage = totalrecord / PageSize;
  125.                  else  // 如果最后还空余一页
  126.                  totalPage = (int) Math.floor( totalrecord / PageSize ) + 1;
  127.                  if(totalPage == 0) totalPage = 1;
  128.                  if(request.getParameter("Page")==null || request.getParameter("Page").equals(""))
  129.                  Page = 1;
  130.                  else
  131.                  try {
  132.                  Page = Integer.parseInt(request.getParameter("Page"));
  133.                  }
  134.                     catch(java.lang.NumberFormatException e){
  135.                  // 捕获用户从浏览器地址拦直接输入Page=sdfsdfsdf所造成的异常
  136.                  Page = 1;
  137.                  }
  138.                  if(Page < 1)  Page = 1;
  139.                  if(Page > totalPage) Page = totalPage;
  140.                  rs.absolute((Page-1) * PageSize + 1); 
  141.             // end
  142.             // HTML // begin [file="/kecheng1.jsp";from=(74,41);to=(75,0)]
  143.                 out.write("rn");
  144.             // end
  145.             // begin [file="/kecheng1.jsp";from=(75,2);to=(76,46)]
  146.                 
  147.                  for(int iPage=1; iPage<=PageSize; iPage++) { 
  148.             // end
  149.             // HTML // begin [file="/kecheng1.jsp";from=(76,48);to=(81,55)]
  150.                 out.write("rntt<div align="right"></div> </td>rn    </tr>rnrn    <tr>rn          <td align="center"><a href="kecheng2.jsp?id2=");
  151.             // end
  152.             // begin [file="/kecheng1.jsp";from=(81,58);to=(81,73)]
  153.                 out.print(rs.getString(1));
  154.             // end
  155.             // HTML // begin [file="/kecheng1.jsp";from=(81,75);to=(82,22)]
  156.                 out.write("" >添加</a></td>rnt  <td align="center">");
  157.             // end
  158.             // begin [file="/kecheng1.jsp";from=(82,25);to=(82,40)]
  159.                 out.print(rs.getString(1));
  160.             // end
  161.             // HTML // begin [file="/kecheng1.jsp";from=(82,42);to=(83,29)]
  162.                 out.write("</td>rn          <td align="center">");
  163.             // end
  164.             // begin [file="/kecheng1.jsp";from=(83,32);to=(83,47)]
  165.                 out.print(rs.getString(2));
  166.             // end
  167.             // HTML // begin [file="/kecheng1.jsp";from=(83,49);to=(84,22)]
  168.                 out.write("</td>rnt  <td align="center">");
  169.             // end
  170.             // begin [file="/kecheng1.jsp";from=(84,25);to=(84,40)]
  171.                 out.print(rs.getString(3));
  172.             // end
  173.             // HTML // begin [file="/kecheng1.jsp";from=(84,42);to=(85,22)]
  174.                 out.write("</td>rnt  <td align="center">");
  175.             // end
  176.             // begin [file="/kecheng1.jsp";from=(85,25);to=(85,40)]
  177.                 out.print(rs.getString(4));
  178.             // end
  179.             // HTML // begin [file="/kecheng1.jsp";from=(85,42);to=(86,22)]
  180.                 out.write("</td>rnt  <td align="center">");
  181.             // end
  182.             // begin [file="/kecheng1.jsp";from=(86,25);to=(86,40)]
  183.                 out.print(rs.getString(5));
  184.             // end
  185.             // HTML // begin [file="/kecheng1.jsp";from=(86,42);to=(87,22)]
  186.                 out.write("</td>rnt  <td align="center">");
  187.             // end
  188.             // begin [file="/kecheng1.jsp";from=(87,25);to=(87,40)]
  189.                 out.print(rs.getString(6));
  190.             // end
  191.             // HTML // begin [file="/kecheng1.jsp";from=(87,42);to=(91,2)]
  192.                 out.write("</td>rnrnrnt     </tr>rntt");
  193.             // end
  194.             // begin [file="/kecheng1.jsp";from=(91,4);to=(93,0)]
  195.                  if(!rs.next()) break;
  196.                  }
  197.             // end
  198.             // HTML // begin [file="/kecheng1.jsp";from=(93,2);to=(101,0)]
  199.                 out.write("rn</table>rnrn</form>rnrnrnrn<FORM Action="kecheng1.jsp" Method="GET">rn");
  200.             // end
  201.             // begin [file="/kecheng1.jsp";from=(101,2);to=(110,0)]
  202.                 
  203.                    if(Page != 1) {
  204.                       out.print("   <A HREF=kecheng1.jsp?Page=1> 第一页 </A>");
  205.                       out.print("   <A HREF=kecheng1.jsp?Page=" + (Page-1) + "> 上一页 </A>");
  206.                    }
  207.                    if(Page != totalPage) {
  208.                       out.print("   <A HREF=kecheng1.jsp?Page=" + (Page+1) + "> 下一页 </A>");
  209.                       out.print("   <A HREF=kecheng1.jsp?Page=" + totalPage + "> 最后一页 </A>");
  210.                    }
  211.             // end
  212.             // HTML // begin [file="/kecheng1.jsp";from=(110,2);to=(112,21)]
  213.                 out.write("rn&nbsp;输入页数:<input TYPE="TEXT" Name="Page" SIZE="3">rn页数:<font COLOR="Red">");
  214.             // end
  215.             // begin [file="/kecheng1.jsp";from=(112,24);to=(112,28)]
  216.                 out.print(Page);
  217.             // end
  218.             // HTML // begin [file="/kecheng1.jsp";from=(112,30);to=(112,31)]
  219.                 out.write("/");
  220.             // end
  221.             // begin [file="/kecheng1.jsp";from=(112,34);to=(112,43)]
  222.                 out.print(totalPage);
  223.             // end
  224.             // HTML // begin [file="/kecheng1.jsp";from=(112,45);to=(117,0)]
  225.                 out.write("</font>rn<INPUT TYPE="submit" value="提交">rn</FORM>rn</body>rn</html>rn");
  226.             // end
  227.         } catch (Throwable t) {
  228.             if (out != null && out.getBufferSize() != 0)
  229.                 out.clearBuffer();
  230.             if (pageContext != null) pageContext.handlePageException(t);
  231.         } finally {
  232.             if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
  233.         }
  234.     }
  235. }