chakan2_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 chakan2_0002ejsp_jsp extends HttpJspBase {
- // begin [file="/chakan2.jsp";from=(5,0);to=(5,57)]
- // end
- static {
- }
- public chakan2_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="/chakan2.jsp";from=(0,48);to=(1,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/chakan2.jsp";from=(1,31);to=(2,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/chakan2.jsp";from=(2,27);to=(3,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/chakan2.jsp";from=(3,32);to=(4,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/chakan2.jsp";from=(4,30);to=(5,0)]
- out.write("rn");
- // end
- // begin [file="/chakan2.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="/chakan2.jsp";from=(5,0);to=(5,57)]
- }
- // end
- // HTML // begin [file="/chakan2.jsp";from=(5,57);to=(13,3)]
- out.write("rn<html>rn<head>rn<title>rnchakan1_2rn</title>rn</head>rn<body bgcolor="#ffffff">rn ");
- // end
- // begin [file="/chakan2.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 chengji where kch='"+kechenghao+"'";
- ResultSet rs=a.executeQuery(sql);
- if(rs.next())
- {
- name=rs.getString("kcm");
- // end
- // HTML // begin [file="/chakan2.jsp";from=(25,7);to=(26,32)]
- out.write("rn <br> 课程号:<font color="red">");
- // end
- // begin [file="/chakan2.jsp";from=(26,35);to=(26,46)]
- out.print(kechenghao );
- // end
- // HTML // begin [file="/chakan2.jsp";from=(26,48);to=(26,90)]
- out.write("</font> 课程名:<font color="red">");
- // end
- // begin [file="/chakan2.jsp";from=(26,93);to=(26,98)]
- out.print(name );
- // end
- // HTML // begin [file="/chakan2.jsp";from=(26,100);to=(27,5)]
- out.write("</font>,选修该课学生成绩如下:<br><br><hr><br><br>rn ");
- // end
- // begin [file="/chakan2.jsp";from=(27,7);to=(35,9)]
- sql1 = "SELECT count(*) as recordcount FROM 成绩关联 where 课程号='"+kechenghao+"'";
- ResultSet bs = a.executeQuery(sql1);
- if (bs.next())
- {
- totalrecord = bs.getInt("recordcount");
- if(totalrecord!=0){
- sql2="SELECT * FROM student,成绩关联 where student.stu_id=成绩关联.stu_id and 成绩关联.课程号='"+kechenghao+"'";
- ResultSet ts=a.executeQuery(sql2);
- // end
- // HTML // begin [file="/chakan2.jsp";from=(35,11);to=(45,13)]
- out.write("rn <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>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="/chakan2.jsp";from=(45,15);to=(46,30)]
- while(ts.next()){
- // end
- // HTML // begin [file="/chakan2.jsp";from=(46,32);to=(48,34)]
- out.write("rn <tr>rn <td align="center">");
- // end
- // begin [file="/chakan2.jsp";from=(48,37);to=(48,52)]
- out.print(ts.getString(1));
- // end
- // HTML // begin [file="/chakan2.jsp";from=(48,54);to=(49,34)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/chakan2.jsp";from=(49,37);to=(49,52)]
- out.print(ts.getString(2));
- // end
- // HTML // begin [file="/chakan2.jsp";from=(49,54);to=(50,34)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/chakan2.jsp";from=(50,37);to=(50,52)]
- out.print(ts.getString(4));
- // end
- // HTML // begin [file="/chakan2.jsp";from=(50,54);to=(51,34)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/chakan2.jsp";from=(51,37);to=(51,53)]
- out.print(ts.getString(24));
- // end
- // HTML // begin [file="/chakan2.jsp";from=(51,55);to=(52,34)]
- out.write("</td>rn <td align="center">");
- // end
- // begin [file="/chakan2.jsp";from=(52,37);to=(52,53)]
- out.print(ts.getString(25));
- // end
- // HTML // begin [file="/chakan2.jsp";from=(52,55);to=(54,13)]
- out.write("</td>rn </tr>rn ");
- // end
- // begin [file="/chakan2.jsp";from=(54,15);to=(54,17)]
- }
- // end
- // HTML // begin [file="/chakan2.jsp";from=(54,19);to=(57,61)]
- out.write("rn </table><br >rn <center>rn 该基础课有成绩的人数为: <input type="text" value="");
- // end
- // begin [file="/chakan2.jsp";from=(57,64);to=(57,75)]
- out.print(totalrecord);
- // end
- // HTML // begin [file="/chakan2.jsp";from=(57,77);to=(59,11)]
- out.write("" size="2" align="right" readonly="readonly"> 人rn </center>rn ");
- // end
- // begin [file="/chakan2.jsp";from=(59,13);to=(60,12)]
- }else
- {
- // end
- // HTML // begin [file="/chakan2.jsp";from=(60,14);to=(66,11)]
- out.write("rn <script language="javascript">rn alert("没有选修这门课程的学生");rn history.go(-1);rn history.go(0);rn </script>rn ");
- // end
- // begin [file="/chakan2.jsp";from=(66,13);to=(68,12)]
- }
- }else
- {
- // end
- // HTML // begin [file="/chakan2.jsp";from=(68,14);to=(74,11)]
- out.write("rn <script language="javascript">rn alert("没有选修这门课程的学生");rn history.go(-1);rn history.go(0);rn </script>rn ");
- // end
- // begin [file="/chakan2.jsp";from=(74,13);to=(77,6)]
- }
- }
- else
- {
- // end
- // HTML // begin [file="/chakan2.jsp";from=(77,8);to=(83,3)]
- out.write("rn <script language="javascript">rn alert("没有你输入的课程号,请重新输入");rn history.go(-1);rn history.go(0);rn </script>rn ");
- // end
- // begin [file="/chakan2.jsp";from=(83,5);to=(84,6)]
- }
- // end
- // HTML // begin [file="/chakan2.jsp";from=(84,8);to=(92,0)]
- out.write("rnrnrnrnrn</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);
- }
- }
- }