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