course_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 course_0002ejsp_jsp extends HttpJspBase {
  9.     // begin [file="/course.jsp";from=(5,0);to=(5,57)]
  10.     // end
  11.     static {
  12.     }
  13.     public course_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="/course.jsp";from=(0,48);to=(1,0)]
  46.                 out.write("rn");
  47.             // end
  48.             // HTML // begin [file="/course.jsp";from=(1,31);to=(2,0)]
  49.                 out.write("rn");
  50.             // end
  51.             // HTML // begin [file="/course.jsp";from=(2,27);to=(3,0)]
  52.                 out.write("rn");
  53.             // end
  54.             // HTML // begin [file="/course.jsp";from=(3,32);to=(4,0)]
  55.                 out.write("rn");
  56.             // end
  57.             // HTML // begin [file="/course.jsp";from=(4,30);to=(5,0)]
  58.                 out.write("rn");
  59.             // end
  60.             // begin [file="/course.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="/course.jsp";from=(5,0);to=(5,57)]
  81.                 }
  82.             // end
  83.             // HTML // begin [file="/course.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="/course.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 chengji";
  100.                  rs = a.executeQuery(sql);
  101.                  if (rs.next()) totalrecord = rs.getInt("recordcount");
  102.                  //输出记录
  103.                  sql = "SELECT * FROM chengji";
  104.                     rs = a.executeQuery(sql);
  105.             // end
  106.             // HTML // begin [file="/course.jsp";from=(36,2);to=(53,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="6" 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>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    </tr>rnrn");
  108.             // end
  109.             // begin [file="/course.jsp";from=(53,2);to=(71,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="/course.jsp";from=(71,41);to=(72,0)]
  131.                 out.write("rn");
  132.             // end
  133.             // begin [file="/course.jsp";from=(72,2);to=(73,46)]
  134.                 
  135.                  for(int iPage=1; iPage<=PageSize; iPage++) { 
  136.             // end
  137.             // HTML // begin [file="/course.jsp";from=(73,48);to=(78,62)]
  138.                 out.write("rntt<div align="right"></div> </td>rn    </tr>rnrn    <tr>rn            <td align="center"><a href="delete_course.jsp?id3=");
  139.             // end
  140.             // begin [file="/course.jsp";from=(78,65);to=(78,84)]
  141.                 out.print(rs.getString("xqh"));
  142.             // end
  143.             // HTML // begin [file="/course.jsp";from=(78,86);to=(79,22)]
  144.                 out.write("" onclick="return a()" >删除</a></td>rnt  <td align="center">");
  145.             // end
  146.             // begin [file="/course.jsp";from=(79,25);to=(79,40)]
  147.                 out.print(rs.getString(1));
  148.             // end
  149.             // HTML // begin [file="/course.jsp";from=(79,42);to=(80,29)]
  150.                 out.write("</td>rn          <td align="center">");
  151.             // end
  152.             // begin [file="/course.jsp";from=(80,32);to=(80,47)]
  153.                 out.print(rs.getString(2));
  154.             // end
  155.             // HTML // begin [file="/course.jsp";from=(80,49);to=(81,22)]
  156.                 out.write("</td>rnt  <td align="center">");
  157.             // end
  158.             // begin [file="/course.jsp";from=(81,25);to=(81,40)]
  159.                 out.print(rs.getString(3));
  160.             // end
  161.             // HTML // begin [file="/course.jsp";from=(81,42);to=(82,22)]
  162.                 out.write("</td>rnt  <td align="center">");
  163.             // end
  164.             // begin [file="/course.jsp";from=(82,25);to=(82,40)]
  165.                 out.print(rs.getString(4));
  166.             // end
  167.             // HTML // begin [file="/course.jsp";from=(82,42);to=(83,22)]
  168.                 out.write("</td>rnt  <td align="center">");
  169.             // end
  170.             // begin [file="/course.jsp";from=(83,25);to=(83,40)]
  171.                 out.print(rs.getString(5));
  172.             // end
  173.             // HTML // begin [file="/course.jsp";from=(83,42);to=(88,2)]
  174.                 out.write("</td>rnrnrnrnt     </tr>rntt");
  175.             // end
  176.             // begin [file="/course.jsp";from=(88,4);to=(90,0)]
  177.                  if(!rs.next()) break;
  178.                  }
  179.             // end
  180.             // HTML // begin [file="/course.jsp";from=(90,2);to=(98,0)]
  181.                 out.write("rn</table>rnrnrnrnrnrn<FORM Action="list_course.jsp" Method="GET">rn");
  182.             // end
  183.             // begin [file="/course.jsp";from=(98,2);to=(107,0)]
  184.                 
  185.                    if(Page != 1) {
  186.                       out.print("   <A HREF=course.jsp?Page=1> 第一页 </A>");
  187.                       out.print("   <A HREF=course.jsp?Page=" + (Page-1) + "> 上一页 </A>");
  188.                    }
  189.                    if(Page != totalPage) {
  190.                       out.print("   <A HREF=course.jsp?Page=" + (Page+1) + "> 下一页 </A>");
  191.                       out.print("   <A HREF=course.jsp?Page=" + totalPage + "> 最后一页 </A>");
  192.                    }
  193.             // end
  194.             // HTML // begin [file="/course.jsp";from=(107,2);to=(109,21)]
  195.                 out.write("rn&nbsp;输入页数:<input TYPE="TEXT" Name="Page" SIZE="3">rn页数:<font COLOR="Red">");
  196.             // end
  197.             // begin [file="/course.jsp";from=(109,24);to=(109,28)]
  198.                 out.print(Page);
  199.             // end
  200.             // HTML // begin [file="/course.jsp";from=(109,30);to=(109,31)]
  201.                 out.write("/");
  202.             // end
  203.             // begin [file="/course.jsp";from=(109,34);to=(109,43)]
  204.                 out.print(totalPage);
  205.             // end
  206.             // HTML // begin [file="/course.jsp";from=(109,45);to=(114,0)]
  207.                 out.write("</font>rn<INPUT TYPE="submit" value="提交">rn</FORM>rn</body>rn</html>rn");
  208.             // end
  209.         } catch (Throwable t) {
  210.             if (out != null && out.getBufferSize() != 0)
  211.                 out.clearBuffer();
  212.             if (pageContext != null) pageContext.handlePageException(t);
  213.         } finally {
  214.             if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
  215.         }
  216.     }
  217. }