searchscore_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 searchscore_0002ejsp_jsp extends HttpJspBase {
- static {
- }
- public searchscore_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=gb2312");
- pageContext = _jspxFactory.getPageContext(this, request, response,
- "", true, 8192, true);
- application = pageContext.getServletContext();
- config = pageContext.getServletConfig();
- session = pageContext.getSession();
- out = pageContext.getOut();
- // HTML // begin [file="/searchscore.jsp";from=(0,48);to=(1,0)]
- out.write("rn");
- // end
- // HTML // begin [file="/searchscore.jsp";from=(1,29);to=(17,0)]
- out.write("rn<HTML>rn <head><SCRIPT language="JavaScript">rnfunction a() {rnrntif(form1.keywords.value==""){rnttalert("用户名不能为空,请确定后重新输入");rnttform1.keywords.focus();rnttreturn false;rnt}rnrntreturn true;rn}</script>rn</head>rn <BODY background="img/main_5.jpg"><br>rnrn");
- // end
- // begin [file="/searchscore.jsp";from=(17,2);to=(64,0)]
- Connection conn = null;
- Statement stmt = null;
- ResultSet rs = null;
- try{
- Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
- }
- catch(ClassNotFoundException ce){
- out.println(ce.getMessage());
- }
- request.setCharacterEncoding("GBK");
- String str = request.getParameter("keywords");
- if( str == null)
- str = "";
- else
- try{
- conn=DriverManager.getConnection("jdbc:odbc:dsn112");
- stmt=conn.createStatement();
- rs=stmt.executeQuery("SELECT * FROM stu001 WHERE stu_id LIKE '%" + str + "%'");
- out.print("<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;'>");
- out.print("<tr bgcolor='EcEcff' align='center'><TD>学期号</TD>");
- out.print("<TD>课程号</TD>");
- out.print("<TD>课程名</TD>");
- out.print("<TD>学分</TD>");
- out.print("<TD>成绩</TD>");
- out.print("<TD>重修成绩</TD>");
- out.print("<TD>主讲老师</TD></TR>");
- while(rs.next()){
- out.print("<tr align='center'><TD>"+rs.getString("xq_id")+"</TD>");
- out.print("<TD>"+rs.getString("co_id")+"</TD>");
- out.print("<TD>"+rs.getString("co_name")+"</TD>");
- out.print("<TD>"+rs.getString("credit_hour")+"</TD>");
- out.print("<TD>"+rs.getString("cj")+"</TD>");
- out.print("<TD>"+rs.getString("cxcj")+"</TD>");
- out.print("<TD>"+rs.getString("teacher")+"</TD></TR>");
- }
- out.print("</TABLE>");
- }
- catch(SQLException e){
- System.out.println(e.getMessage());
- }
- finally{
- stmt.close();
- conn.close();
- }
- // end
- // HTML // begin [file="/searchscore.jsp";from=(64,2);to=(73,46)]
- out.write("rnrn <FORM name="form1" Action="" Method="POST">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;">rnrn<tr >rn <td bgcolor="#EcEcff" colspan="2"><div align="center" ><font size="5" >查找成绩</strong></font></div></td>rn </tr>rn<tr ><td>请输入你的学号:</td>rn<td><INPUT Type="Text" Name="keywords" Value="");
- // end
- // begin [file="/searchscore.jsp";from=(73,49);to=(73,52)]
- out.print(str);
- // end
- // HTML // begin [file="/searchscore.jsp";from=(73,54);to=(77,0)]
- out.write(""></td></tr>rn<tr ><td height="35" colspan="2"><div align="center"><INPUT Type=Submit Value=" 查找" onClick="return a()" ></td></tr></table>rn</FORM>rn</BODY></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);
- }
- }
- }