xuanxiuke2_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 xuanxiuke2_0002ejsp_jsp extends HttpJspBase {
- // begin [file="/xuanxiuke2.jsp";from=(5,0);to=(5,57)]
- // end
- static {
- }
- public xuanxiuke2_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="/xuanxiuke2.jsp";from=(0,48);to=(1,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(1,31);to=(2,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(2,27);to=(3,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(3,32);to=(4,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(4,30);to=(5,0)]
- out.write("rn");
- // end
- // begin [file="/xuanxiuke2.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="/xuanxiuke2.jsp";from=(5,0);to=(5,57)]
- }
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(5,57);to=(13,3)]
- out.write("rn<html>rn<head>rn<title>rnxuanke_1rn</title>rn</head>rn<body bgcolor="#ffffff">rn ");
- // end
- // begin [file="/xuanxiuke2.jsp";from=(13,5);to=(25,5)]
- String kechenghao=request.getParameter("kechenghao");
- int totalrecord = 0;
- String sql="";
- String sql1="";
- String sql2="";
- String name="";
- sql="SELECT * FROM kecheng where kch='"+kechenghao+"'";
- ResultSet rs=a.executeQuery(sql);
- if(rs.next())
- {
- name=rs.getString("kcm");
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(25,7);to=(26,32)]
- out.write("rn <br> 课程号:<font color="red">");
- // end
- // begin [file="/xuanxiuke2.jsp";from=(26,35);to=(26,46)]
- out.print(kechenghao );
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(26,48);to=(26,90)]
- out.write("</font> 课程名:<font color="red">");
- // end
- // begin [file="/xuanxiuke2.jsp";from=(26,93);to=(26,98)]
- out.print(name );
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(26,100);to=(27,5)]
- out.write("</font>,选修该课程的学生如下:<br><br><hr><br>rn ");
- // end
- // begin [file="/xuanxiuke2.jsp";from=(27,7);to=(35,9)]
- sql1 = "SELECT count(*) as recordcount FROM 选课关联 where kch='"+kechenghao+"'";
- ResultSet bs = a.executeQuery(sql1);
- if (bs.next())
- {
- totalrecord = bs.getInt("recordcount");
- if(totalrecord!=0){
- sql2="SELECT * FROM 选课关联,student where 选课关联.stu_id=student.stu_id and 选课关联.kch='"+kechenghao+"'";
- ResultSet ts=a.executeQuery(sql2);
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(35,11);to=(46,13)]
- out.write("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>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>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>rn </tr>rn ");
- // end
- // begin [file="/xuanxiuke2.jsp";from=(46,15);to=(47,30)]
- while(ts.next()){
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(47,32);to=(49,34)]
- out.write("rn <tr>rn <td align="center">");
- // end
- // begin [file="/xuanxiuke2.jsp";from=(49,37);to=(49,52)]
- out.print(ts.getString(4));
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(49,54);to=(50,34)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/xuanxiuke2.jsp";from=(50,37);to=(50,52)]
- out.print(ts.getString(5));
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(50,54);to=(51,34)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/xuanxiuke2.jsp";from=(51,37);to=(51,52)]
- out.print(ts.getString(7));
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(51,54);to=(52,34)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/xuanxiuke2.jsp";from=(52,37);to=(52,52)]
- out.print(ts.getString(8));
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(52,54);to=(53,34)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/xuanxiuke2.jsp";from=(53,37);to=(53,52)]
- out.print(ts.getString(9));
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(53,54);to=(54,34)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/xuanxiuke2.jsp";from=(54,37);to=(54,53)]
- out.print(ts.getString(10));
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(54,55);to=(56,13)]
- out.write("</td>rn </tr>rn ");
- // end
- // begin [file="/xuanxiuke2.jsp";from=(56,15);to=(56,17)]
- }
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(56,19);to=(59,59)]
- out.write("rn </table><br >rn <center>rn 选修该课程的人数为: <input type="text" value="");
- // end
- // begin [file="/xuanxiuke2.jsp";from=(59,62);to=(59,73)]
- out.print(totalrecord);
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(59,75);to=(61,11)]
- out.write("" size="2" align="right" readonly="readonly"> 人rn </center>rn ");
- // end
- // begin [file="/xuanxiuke2.jsp";from=(61,13);to=(62,12)]
- }else
- {
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(62,14);to=(68,11)]
- out.write("rn <script language="javascript">rn alert("没有选修这门课程的学生");rn history.go(-1);rn history.go(0);rn </script>rn ");
- // end
- // begin [file="/xuanxiuke2.jsp";from=(68,13);to=(70,12)]
- }
- }else
- {
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(70,14);to=(76,11)]
- out.write("rn <script language="javascript">rn alert("没有选修这门课程的学生");rn history.go(-1);rn history.go(0);rn </script>rn ");
- // end
- // begin [file="/xuanxiuke2.jsp";from=(76,13);to=(79,6)]
- }
- }
- else
- {
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(79,8);to=(85,3)]
- out.write("rn <script language="javascript">rn alert("没有你输入的课程号,请重新输入");rn history.go(-1);rn history.go(0);rn </script>rn ");
- // end
- // begin [file="/xuanxiuke2.jsp";from=(85,5);to=(86,6)]
- }
- // end
- // HTML // begin [file="/xuanxiuke2.jsp";from=(86,8);to=(96,0)]
- out.write("rnrn<br><br><br><br>rn <center><a href="xuanxiuke.jsp">返回</a></center>rnrnrnrn</body>rnrn</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);
- }
- }
- }