xuanxiuke1_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 xuanxiuke1_0002ejsp_jsp extends HttpJspBase {
- // begin [file="/xuanxiuke1.jsp";from=(5,0);to=(5,57)]
- // end
- static {
- }
- public xuanxiuke1_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="/xuanxiuke1.jsp";from=(0,48);to=(1,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(1,31);to=(2,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(2,27);to=(3,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(3,32);to=(4,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(4,30);to=(5,0)]
- out.write("rn");
- // end
- // begin [file="/xuanxiuke1.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="/xuanxiuke1.jsp";from=(5,0);to=(5,57)]
- }
- // end
- // HTML // begin [file="/xuanxiuke1.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="/xuanxiuke1.jsp";from=(13,5);to=(25,5)]
- String stu_id=request.getParameter("stu_id");
- int totalrecord = 0;
- String sql="";
- String sql1="";
- String sql2="";
- String name="";
- sql="SELECT * FROM student where stu_id='"+stu_id+"'";
- ResultSet rs=a.executeQuery(sql);
- if(rs.next())
- {
- name=rs.getString("stu_name");
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(25,7);to=(26,31)]
- out.write("rn <br> 学号:<font color="red">");
- // end
- // begin [file="/xuanxiuke1.jsp";from=(26,34);to=(26,41)]
- out.print(stu_id );
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(26,43);to=(26,84)]
- out.write("</font> 姓名:<font color="red">");
- // end
- // begin [file="/xuanxiuke1.jsp";from=(26,87);to=(26,92)]
- out.print(name );
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(26,94);to=(27,5)]
- out.write("</font>,所选修的课程如下:<br><br><hr><br><br>rn ");
- // end
- // begin [file="/xuanxiuke1.jsp";from=(27,7);to=(35,9)]
- sql1 = "SELECT count(*) as recordcount FROM 选课关联 where stu_id='"+stu_id+"'";
- ResultSet bs = a.executeQuery(sql1);
- if (bs.next())
- {
- totalrecord = bs.getInt("recordcount");
- if(totalrecord!=0){
- sql2="SELECT * FROM 选课关联,kecheng where 选课关联.kch=kecheng.kch and 选课关联.stu_id='"+stu_id+"'";
- ResultSet ts=a.executeQuery(sql2);
- // end
- // HTML // begin [file="/xuanxiuke1.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="/xuanxiuke1.jsp";from=(46,15);to=(47,30)]
- while(ts.next()){
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(47,32);to=(49,34)]
- out.write("rn <tr>rn <td align="center">");
- // end
- // begin [file="/xuanxiuke1.jsp";from=(49,37);to=(49,56)]
- out.print(ts.getString("kch"));
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(49,58);to=(50,34)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/xuanxiuke1.jsp";from=(50,37);to=(50,56)]
- out.print(ts.getString("kcm"));
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(50,58);to=(51,34)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/xuanxiuke1.jsp";from=(51,37);to=(51,57)]
- out.print(ts.getString("rkjs"));
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(51,59);to=(52,34)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/xuanxiuke1.jsp";from=(52,37);to=(52,56)]
- out.print(ts.getString("xqj"));
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(52,58);to=(53,34)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/xuanxiuke1.jsp";from=(53,37);to=(53,55)]
- out.print(ts.getString("sj"));
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(53,57);to=(54,34)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/xuanxiuke1.jsp";from=(54,37);to=(54,57)]
- out.print(ts.getString("skjs"));
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(54,59);to=(56,13)]
- out.write("</td>rn </tr>rn ");
- // end
- // begin [file="/xuanxiuke1.jsp";from=(56,15);to=(56,17)]
- }
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(56,19);to=(58,11)]
- out.write("rn </table>rn ");
- // end
- // begin [file="/xuanxiuke1.jsp";from=(58,13);to=(59,12)]
- }else
- {
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(59,14);to=(65,11)]
- out.write("rn <script language="javascript">rn alert("该学生没有选课");rn history.go(-1);rn history.go(0);rn </script>rn ");
- // end
- // begin [file="/xuanxiuke1.jsp";from=(65,13);to=(67,12)]
- }
- }else
- {
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(67,14);to=(73,11)]
- out.write("rn <script language="javascript">rn alert("该学生没有选课");rn history.go(-1);rn history.go(0);rn </script>rn ");
- // end
- // begin [file="/xuanxiuke1.jsp";from=(73,13);to=(76,6)]
- }
- }
- else
- {
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(76,8);to=(82,3)]
- out.write("rn <script language="javascript">rn alert("没有你输入的学生,请重新输入");rn history.go(-1);rn history.go(0);rn </script>rn ");
- // end
- // begin [file="/xuanxiuke1.jsp";from=(82,5);to=(83,6)]
- }
- // end
- // HTML // begin [file="/xuanxiuke1.jsp";from=(83,8);to=(91,0)]
- out.write("rn<br><br><br>rnrn <a href="xuanxiuke.jsp">返回</a>rnrn</body>rnrnrn");
- // 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);
- }
- }
- }