⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adminscore2_0002ejsp_jsp.java

📁 网上选课程序:a.使用JSP/Servlet开发
💻 JAVA
字号:
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;


public class adminscore2_0002ejsp_jsp extends HttpJspBase {

    // begin [file="/adminscore2.jsp";from=(2,0);to=(2,59)]
    // end
    // begin [file="/adminscore2.jsp";from=(3,3);to=(18,0)]
         String trans(String chi)
        {
                       String result = null;
                       byte temp [];
                       try
                        {
                              temp=chi.getBytes("iso-8859-1");
                              result = new String(temp, "gb2312");
                        }
                        catch(Exception e)
                        {
                                System.out.println (e.toString());
                        }
                        return result;
        }
    // end

    static {
    }
    public adminscore2_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="/adminscore2.jsp";from=(0,69);to=(1,0)]
                out.write("\r\n");

            // end
            // HTML // begin [file="/adminscore2.jsp";from=(1,33);to=(2,0)]
                out.write("\r\n");

            // end
            // begin [file="/adminscore2.jsp";from=(2,0);to=(2,59)]
                wsxk.ConDB subject = null;
                boolean _jspx_specialsubject  = false;
                 synchronized (pageContext) {
                    subject= (wsxk.ConDB)
                    pageContext.getAttribute("subject",PageContext.PAGE_SCOPE);
                    if ( subject == null ) {
                        _jspx_specialsubject = true;
                        try {
                            subject = (wsxk.ConDB) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "wsxk.ConDB");
                        } catch (ClassNotFoundException exc) {
                             throw new InstantiationException(exc.getMessage());
                        } catch (Exception exc) {
                             throw new ServletException (" Cannot create bean of class "+"wsxk.ConDB", exc);
                        }
                        pageContext.setAttribute("subject", subject, PageContext.PAGE_SCOPE);
                    }
                 } 
                if(_jspx_specialsubject == true) {
            // end
            // begin [file="/adminscore2.jsp";from=(2,0);to=(2,59)]
                }
            // end
            // HTML // begin [file="/adminscore2.jsp";from=(2,59);to=(3,0)]
                out.write("\r\n");

            // end
            // HTML // begin [file="/adminscore2.jsp";from=(18,2);to=(20,0)]
                out.write("\r\n\r\n");

            // end
            // begin [file="/adminscore2.jsp";from=(20,2);to=(42,0)]
                
                	String strSQL1 = "select scoreid from score order by scoreid asc";
                	ResultSet rs5 = subject.executeQuery(strSQL1);
                	String MaxID = new String();
                	int id = 0;
                	while(rs5.next())
                	{
                		id = rs5.getInt("scoreid");
                	}
                	/*int k = 0;
                	for (k = 0; k < 999999; k++)
                	{
                 	  if (id.equals(MaxID.valueOf(k)))
                		break;
                	}
                	++k;
                	if (k >= 999999)
                		k = 1;
                	id = MaxID.valueOf(k);*/
                	id++;
                	System.out.println("id" + id);
                rs5.close();
            // end
            // HTML // begin [file="/adminscore2.jsp";from=(42,2);to=(44,0)]
                out.write("\r\n\r\n");

            // end
            // begin [file="/adminscore2.jsp";from=(44,2);to=(89,0)]
                
                String teaname = new String (request.getParameter("select2"));
                String stuname = new String (request.getParameter("select"));
                String couname = new String (request.getParameter("select3"));
                String result = new String (request.getParameter("select5"));
                String term = new String (request.getParameter("select4"));
                couname=couname.trim();
                couname=trans(couname);
                System.out.println (couname);
                teaname= teaname.trim();
                teaname= trans(teaname);
                System.out.println (teaname);
                stuname = stuname.trim();
                stuname = trans(stuname);
                System.out.println(stuname);
                
                String teaid = new String();
                String couid = new String();
                String stuid = new String();
                String sql = "select couid,couname from course where couname = '"+couname+"'";
                ResultSet rs = subject.executeQuery(sql);
                while(rs.next())
                	{
                		couid = rs.getString("couid");
                	}
                rs.close();
                String sql2= "select teaid,teaname from teacher where teaname = '"+teaname+"'";
                ResultSet rs1 = subject.executeQuery(sql2);
                while(rs1.next())
                	{
                		teaid = rs1.getString("teaid");
                	}
                rs1.close();
                
                String sql3 = "select stuid,stuname from student where stuname = '"+stuname+"'";
                ResultSet rs2 = subject.executeQuery(sql3);
                while(rs2.next())
                	{
                		stuid = rs2.getString("stuid");
                	}
                rs2.close();
                
                System.out.println(couid);
                System.out.println(teaid);
                System.out.println(stuid);
            // end
            // HTML // begin [file="/adminscore2.jsp";from=(89,2);to=(91,0)]
                out.write("\r\n\r\n");

            // end
            // begin [file="/adminscore2.jsp";from=(91,2);to=(98,0)]
                	if (result.trim().equals(""))
                
                	{response.sendRedirect("adminscoreerr.htm");}
                	else {String sql4 = "insert into score(scoreid, stuid,teaid, couid,term,result) values(" + id + ",'"+stuid+"','" + teaid + "','" + couid + "','"+term+"','"+result+"')";
                	subject.executeUpdate(sql4);}
                
                
            // end
            // HTML // begin [file="/adminscore2.jsp";from=(98,2);to=(125,7)]
                out.write("\r\n\r\n<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n<meta HTTP-EQUIV=REFRESH CONTENT=\"10; URL=adminscore.jsp\">\r\n<link href=\"_notes/aaa.css\" rel=\"stylesheet\" type=\"text/css\">\r\n<style type=\"text/css\">\r\n<!--\r\n@import url(\"_notes/ccc\");\r\nbody,td,th {\r\n\tfont-size: 12px;\r\n\tcolor: #FFFFFF;\r\n\tfont-weight: bold;\r\n}\r\n.style1 {color: #000000}\r\n-->\r\n</style>\r\n</HEAD>\r\n<BODY BGCOLOR=#0D85A6 BACKGROUND=\"images/bg.gif\" >\r\n<div align=\"center\">\r\n  <p align=\"left\">    <br>\r\n  学生成绩录入成功,本页将于10秒内自动<a href=\"adminscore.jsp\" class=\"style1\">返回前页</a></p>\r\n  <p><br>\r\n    <img src=\"images/qa.jpg\" width=\"640\" height=\"427\"></p>\r\n</div>\r\n</BODY>\r\n</HTML>");

            // 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);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -