kecheng1_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 kecheng1_0002ejsp_jsp extends HttpJspBase {
- // begin [file="/kecheng1.jsp";from=(5,0);to=(5,57)]
- // end
- static {
- }
- public kecheng1_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="/kecheng1.jsp";from=(0,48);to=(1,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(1,31);to=(2,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(2,27);to=(3,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(3,32);to=(4,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(4,30);to=(5,0)]
- out.write("rn");
- // end
- // begin [file="/kecheng1.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="/kecheng1.jsp";from=(5,0);to=(5,57)]
- }
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(5,57);to=(17,51)]
- out.write("rn<html>rn<head>rn <style type="TEXT/CSS">rn A:LINK{COLOR:blue;FONT-SIZE:11PT;TEXT-DECORATION:NONE}rn A:VISITED{COLOR:blue;FONT-SIZE:11PT;TEXT-DECORATION:NONE}rn A:HOVER{COLOR:red;FONT-SIZE:11PT;TEXT-DECORATION:UNDERLINE}</STYLE>rn<title>rnkecheng1rn</title>rn</head>rn<body bgcolor="#ffffff"><br>rn 姓名: <font color="#0033FF">");
- // end
- // begin [file="/kecheng1.jsp";from=(17,54);to=(17,87)]
- out.print(session.getAttribute("stu_name") );
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(17,89);to=(17,150)]
- out.write(" </font> 学号: <font color="#0033FF">");
- // end
- // begin [file="/kecheng1.jsp";from=(17,153);to=(17,180)]
- out.print(session.getAttribute("id") );
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(17,182);to=(19,0)]
- out.write("</font><br>rn <hr><br>rn");
- // end
- // begin [file="/kecheng1.jsp";from=(19,2);to=(37,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="/kecheng1.jsp";from=(37,2);to=(56,0)]
- out.write("rn<form action="kecheng2.jsp" method="POST" name="form3">rnrn<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="7" 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>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<td align="center"><font color="#6633CC">时间</font></td>rnt<td align="center"><font color="#6633CC">上课教室</font></td>rnrn </tr>rnrn");
- // end
- // begin [file="/kecheng1.jsp";from=(56,2);to=(74,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="/kecheng1.jsp";from=(74,41);to=(75,0)]
- out.write("rn");
- // end
- // begin [file="/kecheng1.jsp";from=(75,2);to=(76,46)]
- for(int iPage=1; iPage<=PageSize; iPage++) {
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(76,48);to=(81,55)]
- out.write("rntt<div align="right"></div> </td>rn </tr>rnrn <tr>rn <td align="center"><a href="kecheng2.jsp?id2=");
- // end
- // begin [file="/kecheng1.jsp";from=(81,58);to=(81,73)]
- out.print(rs.getString(1));
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(81,75);to=(82,22)]
- out.write("" >添加</a></td>rnt <td align="center">");
- // end
- // begin [file="/kecheng1.jsp";from=(82,25);to=(82,40)]
- out.print(rs.getString(1));
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(82,42);to=(83,29)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/kecheng1.jsp";from=(83,32);to=(83,47)]
- out.print(rs.getString(2));
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(83,49);to=(84,22)]
- out.write("</td>rnt <td align="center">");
- // end
- // begin [file="/kecheng1.jsp";from=(84,25);to=(84,40)]
- out.print(rs.getString(3));
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(84,42);to=(85,22)]
- out.write("</td>rnt <td align="center">");
- // end
- // begin [file="/kecheng1.jsp";from=(85,25);to=(85,40)]
- out.print(rs.getString(4));
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(85,42);to=(86,22)]
- out.write("</td>rnt <td align="center">");
- // end
- // begin [file="/kecheng1.jsp";from=(86,25);to=(86,40)]
- out.print(rs.getString(5));
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(86,42);to=(87,22)]
- out.write("</td>rnt <td align="center">");
- // end
- // begin [file="/kecheng1.jsp";from=(87,25);to=(87,40)]
- out.print(rs.getString(6));
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(87,42);to=(91,2)]
- out.write("</td>rnrnrnt </tr>rntt");
- // end
- // begin [file="/kecheng1.jsp";from=(91,4);to=(93,0)]
- if(!rs.next()) break;
- }
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(93,2);to=(101,0)]
- out.write("rn</table>rnrn</form>rnrnrnrn<FORM Action="kecheng1.jsp" Method="GET">rn");
- // end
- // begin [file="/kecheng1.jsp";from=(101,2);to=(110,0)]
- if(Page != 1) {
- out.print(" <A HREF=kecheng1.jsp?Page=1> 第一页 </A>");
- out.print(" <A HREF=kecheng1.jsp?Page=" + (Page-1) + "> 上一页 </A>");
- }
- if(Page != totalPage) {
- out.print(" <A HREF=kecheng1.jsp?Page=" + (Page+1) + "> 下一页 </A>");
- out.print(" <A HREF=kecheng1.jsp?Page=" + totalPage + "> 最后一页 </A>");
- }
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(110,2);to=(112,21)]
- out.write("rn 输入页数:<input TYPE="TEXT" Name="Page" SIZE="3">rn页数:<font COLOR="Red">");
- // end
- // begin [file="/kecheng1.jsp";from=(112,24);to=(112,28)]
- out.print(Page);
- // end
- // HTML // begin [file="/kecheng1.jsp";from=(112,30);to=(112,31)]
- out.write("/");
- // end
- // begin [file="/kecheng1.jsp";from=(112,34);to=(112,43)]
- out.print(totalPage);
- // end
- // HTML // begin [file="/kecheng1.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);
- }
- }
- }