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