course_0002ejsp_jsp.java
资源名称:JSP02.rar [点击查看]
上传用户:top0756
上传日期:2022-08-11
资源大小:6501k
文件大小:11k
源码类别:
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 course_0002ejsp_jsp extends HttpJspBase {
- // begin [file="/course.jsp";from=(5,0);to=(5,57)]
- // end
- static {
- }
- public course_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="/course.jsp";from=(0,48);to=(1,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/course.jsp";from=(1,31);to=(2,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/course.jsp";from=(2,27);to=(3,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/course.jsp";from=(3,32);to=(4,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/course.jsp";from=(4,30);to=(5,0)]
- out.write("rn");
- // end
- // begin [file="/course.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="/course.jsp";from=(5,0);to=(5,57)]
- }
- // end
- // HTML // begin [file="/course.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="/course.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 chengji";
- rs = a.executeQuery(sql);
- if (rs.next()) totalrecord = rs.getInt("recordcount");
- //输出记录
- sql = "SELECT * FROM chengji";
- rs = a.executeQuery(sql);
- // end
- // HTML // begin [file="/course.jsp";from=(36,2);to=(53,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="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");
- // end
- // begin [file="/course.jsp";from=(53,2);to=(71,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="/course.jsp";from=(71,41);to=(72,0)]
- out.write("rn");
- // end
- // begin [file="/course.jsp";from=(72,2);to=(73,46)]
- for(int iPage=1; iPage<=PageSize; iPage++) {
- // end
- // HTML // begin [file="/course.jsp";from=(73,48);to=(78,62)]
- out.write("rntt<div align="right"></div> </td>rn </tr>rnrn <tr>rn <td align="center"><a href="delete_course.jsp?id3=");
- // end
- // begin [file="/course.jsp";from=(78,65);to=(78,84)]
- out.print(rs.getString("xqh"));
- // end
- // HTML // begin [file="/course.jsp";from=(78,86);to=(79,22)]
- out.write("" onclick="return a()" >删除</a></td>rnt <td align="center">");
- // end
- // begin [file="/course.jsp";from=(79,25);to=(79,40)]
- out.print(rs.getString(1));
- // end
- // HTML // begin [file="/course.jsp";from=(79,42);to=(80,29)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/course.jsp";from=(80,32);to=(80,47)]
- out.print(rs.getString(2));
- // end
- // HTML // begin [file="/course.jsp";from=(80,49);to=(81,22)]
- out.write("</td>rnt <td align="center">");
- // end
- // begin [file="/course.jsp";from=(81,25);to=(81,40)]
- out.print(rs.getString(3));
- // end
- // HTML // begin [file="/course.jsp";from=(81,42);to=(82,22)]
- out.write("</td>rnt <td align="center">");
- // end
- // begin [file="/course.jsp";from=(82,25);to=(82,40)]
- out.print(rs.getString(4));
- // end
- // HTML // begin [file="/course.jsp";from=(82,42);to=(83,22)]
- out.write("</td>rnt <td align="center">");
- // end
- // begin [file="/course.jsp";from=(83,25);to=(83,40)]
- out.print(rs.getString(5));
- // end
- // HTML // begin [file="/course.jsp";from=(83,42);to=(88,2)]
- out.write("</td>rnrnrnrnt </tr>rntt");
- // end
- // begin [file="/course.jsp";from=(88,4);to=(90,0)]
- if(!rs.next()) break;
- }
- // end
- // HTML // begin [file="/course.jsp";from=(90,2);to=(98,0)]
- out.write("rn</table>rnrnrnrnrnrn<FORM Action="list_course.jsp" Method="GET">rn");
- // end
- // begin [file="/course.jsp";from=(98,2);to=(107,0)]
- if(Page != 1) {
- out.print(" <A HREF=course.jsp?Page=1> 第一页 </A>");
- out.print(" <A HREF=course.jsp?Page=" + (Page-1) + "> 上一页 </A>");
- }
- if(Page != totalPage) {
- out.print(" <A HREF=course.jsp?Page=" + (Page+1) + "> 下一页 </A>");
- out.print(" <A HREF=course.jsp?Page=" + totalPage + "> 最后一页 </A>");
- }
- // end
- // HTML // begin [file="/course.jsp";from=(107,2);to=(109,21)]
- out.write("rn 输入页数:<input TYPE="TEXT" Name="Page" SIZE="3">rn页数:<font COLOR="Red">");
- // end
- // begin [file="/course.jsp";from=(109,24);to=(109,28)]
- out.print(Page);
- // end
- // HTML // begin [file="/course.jsp";from=(109,30);to=(109,31)]
- out.write("/");
- // end
- // begin [file="/course.jsp";from=(109,34);to=(109,43)]
- out.print(totalPage);
- // end
- // HTML // begin [file="/course.jsp";from=(109,45);to=(114,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);
- }
- }
- }