std_0002ejsp_jsp.java
资源名称:JSP02.rar [点击查看]
上传用户:top0756
上传日期:2022-08-11
资源大小:6501k
文件大小:12k
源码类别:
Jsp/Servlet
开发平台:
VBScript
- import java.sql.*;
- import java.util.*;
- import proj112.*;
- import javax.servlet.*;
- import javax.servlet.http.*;
- import javax.servlet.jsp.*;
- import org.apache.jasper.runtime.*;
- public class std_0002ejsp_jsp extends HttpJspBase {
- // begin [file="/std.jsp";from=(5,0);to=(5,57)]
- // end
- static {
- }
- public std_0002ejsp_jsp( ) {
- }
- private static boolean _jspx_inited = false;
- public final void _jspx_init() throws org.apache.jasper.runtime.JspException {
- }
- public void _jspService(HttpServletRequest request, HttpServletResponse response)
- throws java.io.IOException, ServletException {
- JspFactory _jspxFactory = null;
- PageContext pageContext = null;
- HttpSession session = null;
- ServletContext application = null;
- ServletConfig config = null;
- JspWriter out = null;
- Object page = this;
- String _value = null;
- try {
- if (_jspx_inited == false) {
- synchronized (this) {
- if (_jspx_inited == false) {
- _jspx_init();
- _jspx_inited = true;
- }
- }
- }
- _jspxFactory = JspFactory.getDefaultFactory();
- response.setContentType("text/html; charset=GBK");
- pageContext = _jspxFactory.getPageContext(this, request, response,
- "", true, 8192, true);
- application = pageContext.getServletContext();
- config = pageContext.getServletConfig();
- session = pageContext.getSession();
- out = pageContext.getOut();
- // HTML // begin [file="/std.jsp";from=(0,48);to=(1,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/std.jsp";from=(1,31);to=(2,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/std.jsp";from=(2,27);to=(3,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/std.jsp";from=(3,32);to=(4,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/std.jsp";from=(4,30);to=(5,0)]
- out.write("rn");
- // end
- // begin [file="/std.jsp";from=(5,0);to=(5,57)]
- proj112.dbconn a = null;
- boolean _jspx_speciala = false;
- synchronized (pageContext) {
- a= (proj112.dbconn)
- pageContext.getAttribute("a",PageContext.PAGE_SCOPE);
- if ( a == null ) {
- _jspx_speciala = true;
- try {
- a = (proj112.dbconn) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "proj112.dbconn");
- } catch (ClassNotFoundException exc) {
- throw new InstantiationException(exc.getMessage());
- } catch (Exception exc) {
- throw new ServletException (" Cannot create bean of class "+"proj112.dbconn", exc);
- }
- pageContext.setAttribute("a", a, PageContext.PAGE_SCOPE);
- }
- }
- if(_jspx_speciala == true) {
- // end
- // begin [file="/std.jsp";from=(5,0);to=(5,57)]
- }
- // end
- // HTML // begin [file="/std.jsp";from=(5,57);to=(27,0)]
- 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");
- // end
- // begin [file="/std.jsp";from=(27,2);to=(46,0)]
- int PageSize = 6;
- int Page = 1;
- int totalPage = 1;
- int totalrecord = 0;
- String id = "";
- String sql = null;
- ResultSet rs = null;
- //算出总行数
- sql = "SELECT count(*) as recordcount FROM student";
- rs = a.executeQuery(sql);
- if (rs.next()) totalrecord = rs.getInt("recordcount");
- //输出记录
- sql = "SELECT * FROM student";
- rs = a.executeQuery(sql);
- // end
- // HTML // begin [file="/std.jsp";from=(46,2);to=(65,0)]
- 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");
- // end
- // begin [file="/std.jsp";from=(65,2);to=(83,39)]
- if(totalrecord % PageSize ==0)// 如果是当前页码的整数倍
- totalPage = totalrecord / PageSize;
- else // 如果最后还空余一页
- totalPage = (int) Math.floor( totalrecord / PageSize ) + 1;
- if(totalPage == 0) totalPage = 1;
- if(request.getParameter("Page")==null || request.getParameter("Page").equals(""))
- Page = 1;
- else
- try {
- Page = Integer.parseInt(request.getParameter("Page"));
- }
- catch(java.lang.NumberFormatException e){
- // 捕获用户从浏览器地址拦直接输入Page=sdfsdfsdf所造成的异常
- Page = 1;
- }
- if(Page < 1) Page = 1;
- if(Page > totalPage) Page = totalPage;
- rs.absolute((Page-1) * PageSize + 1);
- // end
- // HTML // begin [file="/std.jsp";from=(83,41);to=(84,0)]
- out.write("rn");
- // end
- // begin [file="/std.jsp";from=(84,2);to=(86,50)]
- for(int iPage=1; iPage<=PageSize; iPage++) {
- String name=rs.getString("stu_name");
- // end
- // HTML // begin [file="/std.jsp";from=(86,52);to=(92,22)]
- out.write("rntt<div align="right"></div> </td>rn </tr>rnrn <tr>rnrnt <td align="center">");
- // end
- // begin [file="/std.jsp";from=(92,25);to=(92,49)]
- out.print(rs.getString("stu_name"));
- // end
- // HTML // begin [file="/std.jsp";from=(92,51);to=(93,29)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/std.jsp";from=(93,32);to=(93,54)]
- out.print(rs.getString("stu_id"));
- // end
- // HTML // begin [file="/std.jsp";from=(93,56);to=(95,22)]
- out.write("</td>rnrnt <td align="center">");
- // end
- // begin [file="/std.jsp";from=(95,25);to=(95,44)]
- out.print(rs.getString("sex"));
- // end
- // HTML // begin [file="/std.jsp";from=(95,46);to=(96,22)]
- out.write("</td>rnt <td align="center">");
- // end
- // begin [file="/std.jsp";from=(96,25);to=(96,45)]
- out.print(rs.getString("dept"));
- // end
- // HTML // begin [file="/std.jsp";from=(96,47);to=(97,22)]
- out.write("</td>rnt <td align="center">");
- // end
- // begin [file="/std.jsp";from=(97,25);to=(97,43)]
- out.print(rs.getString("mz"));
- // end
- // HTML // begin [file="/std.jsp";from=(97,45);to=(98,28)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/std.jsp";from=(98,31);to=(98,51)]
- out.print(rs.getString("zzmm"));
- // end
- // HTML // begin [file="/std.jsp";from=(98,53);to=(99,61)]
- out.write("</td>rn <td align="center" width=20%><a href="change.jsp?id=");
- // end
- // begin [file="/std.jsp";from=(99,64);to=(99,68)]
- out.print(name);
- // end
- // HTML // begin [file="/std.jsp";from=(99,70);to=(99,104)]
- out.write("">修改</a> | <a href="delete.jsp?id=");
- // end
- // begin [file="/std.jsp";from=(99,107);to=(99,111)]
- out.print(name);
- // end
- // HTML // begin [file="/std.jsp";from=(99,113);to=(103,2)]
- out.write("">删除</a></td>rnrnrnt </tr>rntt");
- // end
- // begin [file="/std.jsp";from=(103,4);to=(105,0)]
- if(!rs.next()) break;
- }
- // end
- // HTML // begin [file="/std.jsp";from=(105,2);to=(113,0)]
- out.write("rn</table>rnrnrnrnrnrn<FORM Action="std.jsp" Method="GET">rn");
- // end
- // begin [file="/std.jsp";from=(113,2);to=(122,0)]
- if(Page != 1) {
- out.print(" <A HREF=std.jsp?Page=1> 第一页 </A>");
- out.print(" <A HREF=std.jsp?Page=" + (Page-1) + "> 上一页 </A>");
- }
- if(Page != totalPage) {
- out.print(" <A HREF=std.jsp?Page=" + (Page+1) + "> 下一页 </A>");
- out.print(" <A HREF=std.jsp?Page=" + totalPage + "> 最后一页 </A>");
- }
- // end
- // HTML // begin [file="/std.jsp";from=(122,2);to=(124,21)]
- out.write("rn 输入页数:<input TYPE="TEXT" Name="Page" SIZE="3">rn页数:<font COLOR="Red">");
- // end
- // begin [file="/std.jsp";from=(124,24);to=(124,28)]
- out.print(Page);
- // end
- // HTML // begin [file="/std.jsp";from=(124,30);to=(124,31)]
- out.write("/");
- // end
- // begin [file="/std.jsp";from=(124,34);to=(124,43)]
- out.print(totalPage);
- // end
- // HTML // begin [file="/std.jsp";from=(124,45);to=(129,0)]
- out.write("</font>rn<INPUT TYPE="submit" value="提交">rn</FORM>rn</body>rn</html>rn");
- // end
- } catch (Throwable t) {
- if (out != null && out.getBufferSize() != 0)
- out.clearBuffer();
- if (pageContext != null) pageContext.handlePageException(t);
- } finally {
- if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
- }
- }
- }