list_0005fkecheng_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 list_0005fkecheng_0002ejsp_jsp extends HttpJspBase {
- // begin [file="/list_kecheng.jsp";from=(5,0);to=(5,57)]
- // end
- static {
- }
- public list_0005fkecheng_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="/list_kecheng.jsp";from=(0,48);to=(1,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(1,31);to=(2,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(2,27);to=(3,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(3,32);to=(4,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(4,30);to=(5,0)]
- out.write("rn");
- // end
- // begin [file="/list_kecheng.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="/list_kecheng.jsp";from=(5,0);to=(5,57)]
- }
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(5,57);to=(18,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>rnrn");
- // end
- // begin [file="/list_kecheng.jsp";from=(18,2);to=(36,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 kecheng";
- rs = a.executeQuery(sql);
- if (rs.next()) totalrecord = rs.getInt("recordcount");
- //输出记录
- sql = "SELECT * FROM kecheng";
- rs = a.executeQuery(sql);
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(36,2);to=(55,0)]
- 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");
- // end
- // begin [file="/list_kecheng.jsp";from=(55,2);to=(73,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="/list_kecheng.jsp";from=(73,41);to=(74,0)]
- out.write("rn");
- // end
- // begin [file="/list_kecheng.jsp";from=(74,2);to=(76,42)]
- for(int iPage=1; iPage<=PageSize; iPage++) {
- String name=rs.getString("kch");
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(76,44);to=(82,22)]
- out.write("rntt<div align="right"></div> </td>rn </tr>rnrn <tr>rnrnt <td align="center">");
- // end
- // begin [file="/list_kecheng.jsp";from=(82,25);to=(82,40)]
- out.print(rs.getString(1));
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(82,42);to=(83,29)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/list_kecheng.jsp";from=(83,32);to=(83,47)]
- out.print(rs.getString(2));
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(83,49);to=(84,22)]
- out.write("</td>rnt <td align="center">");
- // end
- // begin [file="/list_kecheng.jsp";from=(84,25);to=(84,40)]
- out.print(rs.getString(3));
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(84,42);to=(85,22)]
- out.write("</td>rnt <td align="center">");
- // end
- // begin [file="/list_kecheng.jsp";from=(85,25);to=(85,40)]
- out.print(rs.getString(4));
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(85,42);to=(86,22)]
- out.write("</td>rnt <td align="center">");
- // end
- // begin [file="/list_kecheng.jsp";from=(86,25);to=(86,40)]
- out.print(rs.getString(5));
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(86,42);to=(87,22)]
- out.write("</td>rnt <td align="center">");
- // end
- // begin [file="/list_kecheng.jsp";from=(87,25);to=(87,40)]
- out.print(rs.getString(6));
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(87,42);to=(88,61)]
- out.write("</td>rn <td align="center" width=20%><a href="change.jsp?id=");
- // end
- // begin [file="/list_kecheng.jsp";from=(88,64);to=(88,68)]
- out.print(name);
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(88,70);to=(88,104)]
- out.write("">修改</a> | <a href="delete.jsp?id=");
- // end
- // begin [file="/list_kecheng.jsp";from=(88,107);to=(88,111)]
- out.print(name);
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(88,113);to=(91,2)]
- out.write("">删除</a></td>rnrnt </tr>rntt");
- // end
- // begin [file="/list_kecheng.jsp";from=(91,4);to=(93,0)]
- if(!rs.next()) break;
- }
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(93,2);to=(101,0)]
- out.write("rn</table>rnrnrnrnrnrn<FORM Action="list_kecheng.jsp" Method="GET">rn");
- // end
- // begin [file="/list_kecheng.jsp";from=(101,2);to=(110,0)]
- if(Page != 1) {
- out.print(" <A HREF=list_kecheng.jsp?Page=1> 第一页 </A>");
- out.print(" <A HREF=list_kecheng.jsp?Page=" + (Page-1) + "> 上一页 </A>");
- }
- if(Page != totalPage) {
- out.print(" <A HREF=list_kecheng.jsp?Page=" + (Page+1) + "> 下一页 </A>");
- out.print(" <A HREF=list_kecheng.jsp?Page=" + totalPage + "> 最后一页 </A>");
- }
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(110,2);to=(112,21)]
- out.write("rn 输入页数:<input TYPE="TEXT" Name="Page" SIZE="3">rn页数:<font COLOR="Red">");
- // end
- // begin [file="/list_kecheng.jsp";from=(112,24);to=(112,28)]
- out.print(Page);
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(112,30);to=(112,31)]
- out.write("/");
- // end
- // begin [file="/list_kecheng.jsp";from=(112,34);to=(112,43)]
- out.print(totalPage);
- // end
- // HTML // begin [file="/list_kecheng.jsp";from=(112,45);to=(117,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);
- }
- }
- }