jiangjin_0002ejsp_jsp.java
资源名称:JSP02.rar [点击查看]
上传用户:top0756
上传日期:2022-08-11
资源大小:6501k
文件大小:6k
源码类别:
Jsp/Servlet
开发平台:
VBScript
- import java.sql.*;
- import javax.servlet.*;
- import javax.servlet.http.*;
- import javax.servlet.jsp.*;
- import org.apache.jasper.runtime.*;
- public class jiangjin_0002ejsp_jsp extends HttpJspBase {
- static {
- }
- public jiangjin_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="/jiangjin.jsp";from=(0,48);to=(1,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/jiangjin.jsp";from=(1,31);to=(2,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/jiangjin.jsp";from=(2,27);to=(15,0)]
- out.write("rn<HTML>rn<HEAD>rn<TITLE></TITLE>rn</HEAD>rn<BODY>rn<CENTER>rn<FONT SIZE = 5 COLOR = blue>获奖同学如下</FONT>rn</CENTER>rn<BR>rn<HR>rn<BR>rn<CENTER>rn");
- // end
- // begin [file="/jiangjin.jsp";from=(15,2);to=(21,0)]
- Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //载入驱动程序类别
- Connection con = DriverManager.getConnection("jdbc:odbc:dsn112"); //建立数据库链接
- Statement stmt = con.createStatement(); //建立Statement对象
- ResultSet rs; //建立ResultSet(结果集)对象
- rs = stmt.executeQuery("SELECT * FROM jiangjin"); //执行SQL语句
- // end
- // HTML // begin [file="/jiangjin.jsp";from=(21,2);to=(27,1)]
- out.write("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:99%;border-collapse:collapse;">rnt<TR bgcolor="#EcEcff">rnt<TD><B>学 号</B></TD><TD><B>姓 名</B></TD><TD><B>性 别</B></TD>rn <TD><B>专 业</B></TD><TD><B>班 级</B></TD><TD><B>奖 金</B></TD>rnt</TR>rnt");
- // end
- // begin [file="/jiangjin.jsp";from=(27,3);to=(31,2)]
- //利用while循环将数据表中的记录列出
- while (rs.next())
- {
- // end
- // HTML // begin [file="/jiangjin.jsp";from=(31,4);to=(33,9)]
- out.write("rntt<TR bgcolor=white>rntt<TD><B>");
- // end
- // begin [file="/jiangjin.jsp";from=(33,12);to=(33,36)]
- out.print( rs.getString("stu_id") );
- // end
- // HTML // begin [file="/jiangjin.jsp";from=(33,38);to=(34,9)]
- out.write("</B></TD>rntt<TD><B>");
- // end
- // begin [file="/jiangjin.jsp";from=(34,12);to=(34,34)]
- out.print( rs.getString("name") );
- // end
- // HTML // begin [file="/jiangjin.jsp";from=(34,36);to=(35,9)]
- out.write("</B></TD>rntt<TD><B>");
- // end
- // begin [file="/jiangjin.jsp";from=(35,12);to=(35,33)]
- out.print( rs.getString("sex") );
- // end
- // HTML // begin [file="/jiangjin.jsp";from=(35,35);to=(36,23)]
- out.write("</B></TD>rn <TD><B>");
- // end
- // begin [file="/jiangjin.jsp";from=(36,26);to=(36,48)]
- out.print( rs.getString("dept") );
- // end
- // HTML // begin [file="/jiangjin.jsp";from=(36,50);to=(37,23)]
- out.write("</B></TD>rn <TD><B>");
- // end
- // begin [file="/jiangjin.jsp";from=(37,26);to=(37,49)]
- out.print( rs.getString("class") );
- // end
- // HTML // begin [file="/jiangjin.jsp";from=(37,51);to=(38,23)]
- out.write("</B></TD>rn <TD><B>");
- // end
- // begin [file="/jiangjin.jsp";from=(38,26);to=(38,52)]
- out.print( rs.getString("jiangjin") );
- // end
- // HTML // begin [file="/jiangjin.jsp";from=(38,54);to=(40,2)]
- out.write("</B></TD>rntt</TR>rntt");
- // end
- // begin [file="/jiangjin.jsp";from=(40,4);to=(45,1)]
- }
- rs.close(); //关闭ResultSet对象
- stmt.close(); //关闭Statement对象
- con.close(); //关闭Connection对象
- // end
- // HTML // begin [file="/jiangjin.jsp";from=(45,3);to=(50,0)]
- out.write("rn</TABLE>rn</CENTER>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);
- }
- }
- }