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

📄 leftmessage_jsp.java

📁 用java写的一个简单的在线考试系统
💻 JAVA
字号:
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;

public final class leftmessage_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {


     Connection con=null;
     String str="";
     PreparedStatement pre=null;
     ResultSet set;
     int a3;
     String a1,a2,check1,check3 ,name, mima,stuname, stumima,stuchengji,id4,a4;
    
  private static java.util.List _jspx_dependants;

  public Object getDependants() {
    return _jspx_dependants;
  }

  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;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=gb2312");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			"", true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n");
      out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n");
      out.write("<head>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" />\r\n");
      out.write("<title>无标题文档</title>\r\n");
      out.write("<style type=\"text/css\">\r\n");
      out.write("<!--\r\n");
      out.write(".STYLE1 {\r\n");
      out.write("\tfont-size: 24px;\r\n");
      out.write("\tfont-weight: bold;\r\n");
      out.write("\tcolor: #00FF00;\r\n");
      out.write("}\r\n");
      out.write(".STYLE2 {\r\n");
      out.write("\tcolor: #FF0000;\r\n");
      out.write("\tfont-weight: bold;\r\n");
      out.write("}\r\n");
      out.write(".STYLE4 {color: #00FF00; font-weight: bold; font-size: 16px; }\r\n");
      out.write(".STYLE5 {color: #FF0000}\r\n");
      out.write(".STYLE6 {\r\n");
      out.write("\tfont-size: 16px;\r\n");
      out.write("\tcolor: #00FF00;\r\n");
      out.write("}\r\n");
      out.write("-->\r\n");
      out.write("</style>\r\n");
      out.write("</head>\r\n");
      out.write("\r\n");
      out.write("<body>\r\n");
      out.write("   \r\n");
      out.write("<p class=\"STYLE1\">老师信息</p>\r\n");
      out.write("<table width=\"691\" border=\"0\">\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td width=\"113\" height=\"28\"><form id=\"form1\" name=\"form1\" method=\"post\" action=\"leftmessage.jsp\">\r\n");
      out.write("      <label>\r\n");
      out.write("        <input type=\"checkbox\" name=\"checkbox1\" value=\"checkbox1\" />\r\n");
      out.write("        <span class=\"STYLE2\">全选</span></label>\r\n");
      out.write("      <label>\r\n");
      out.write("      <input type=\"submit\" name=\"Submit\" value=\"删除\" />\r\n");
      out.write("      </label>\r\n");
      out.write("    </form></td>\r\n");
      out.write("    <td width=\"204\"><div align=\"center\" class=\"STYLE4\">姓名</div></td>\r\n");
      out.write("    <td width=\"184\"><div align=\"center\"><span class=\"STYLE4\">密码</span></div></td>\r\n");
      out.write("    <td width=\"172\"><div align=\"center\"><span class=\"STYLE4\">操作</span></div></td>\r\n");
      out.write("  </tr>\r\n");
      out.write("  ");
      out.write("\r\n");
      out.write("  ");

      request.setCharacterEncoding("gb2312");
      check1=request.getParameter("checkbox1");
      check3=request.getParameter("checkbox3");
      String id= (String) request.getParameter("id");
      String id4= (String) request.getParameter("id4");
      name=request.getParameter("uname");
      mima=request.getParameter("umima");
      stuname=request.getParameter("stuname");
      stumima=request.getParameter("stuxuehao");
      stuchengji=request.getParameter("stuchengji");
       try{
           Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          con=DriverManager.getConnection("jdbc:odbc:xing");
          if(mima!=null&name!=null)
              {
           str="insert into loginteacher(mima,name) values(?,?)";
         
          pre=con.prepareStatement(str);
          pre.setString(1,mima);
          pre.setString(2,name);
         pre.executeUpdate();
         }
          else if(id!=null)
              {
            str="delete from loginteacher where ID=?";
           pre=con.prepareStatement(str); 
           int n=Integer.parseInt(id);
           pre.setInt(1,n); 
           pre.executeUpdate();
              }
              else if( stuname!=null&stumima!=null&stuchengji!=null)
                  {
                      str="insert into login(mima,name,chengji) values(?,?,?)";
          pre=con.prepareStatement(str);
          pre.setString(1,stumima);
          pre.setString(2,stuname);
           pre.setString(3,stuchengji);
         pre.executeUpdate();
                  }
                  else if(id4!=null)
              {
            str="delete from login where ID=?";
           pre=con.prepareStatement(str); 
           int n1=Integer.parseInt(id4);
           pre.setInt(1,n1); 
           pre.executeUpdate();
              }else if(check1!=null)
              {
            str="delete from loginteacher ";
           pre=con.prepareStatement(str); 
           pre.executeUpdate();
              }else if(check3!=null)
              {
            str="delete from login ";
           pre=con.prepareStatement(str);  
           pre.executeUpdate();
              }
              
          pre.close();
          con.close();
          }catch(Exception e)
          {
             out.println(e.getMessage());
              }
      
    
      out.write("\r\n");
      out.write("  ");

   
          try{
          
          str="select * from loginteacher";
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          con=DriverManager.getConnection("jdbc:odbc:xing");
          pre=con.prepareStatement(str);
          set=pre.executeQuery();
        while(set.next())
            { 
              a3=set.getInt(1);
              a2=set.getString(2);
              a1=set.getString(3);
            
              
      
      out.write("\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td height=\"27\"><form id=\"form2\" name=\"form2\" method=\"post\" action=\"\">\r\n");
      out.write("      <label>\r\n");
      out.write("        <input type=\"checkbox\" name=\"checkbox2\" value=\"checkbox\" />\r\n");
      out.write("        <span class=\"STYLE5\"> 选择</span></label>\r\n");
      out.write("    </form></td>\r\n");
      out.write("    <td><div align=\"center\"><span class=\"STYLE6\">");
      out.print(a1);
      out.write("</span></div></td>\r\n");
      out.write("    <td><div align=\"center\"><span class=\"STYLE6\">");
      out.print(a2);
      out.write("</span></div></td>\r\n");
      out.write("    <td><div align=\"center\"><span class=\"STYLE4\"><a href=\"dealleftmess.jsp?id1=");
      out.print(a3);
      out.write("\">修改</a>/<a href=\"leftmessage.jsp?id=");
      out.print(a3);
      out.write("\">删除</a></span></div></td>\r\n");
      out.write("  </tr>\r\n");
      out.write("  ");

    }
       set.close();
          pre.close();
          con.close();
          }catch(Exception e)
          {
             out.println(e.getMessage());
              }
      
      out.write("\r\n");
      out.write("</table>\r\n");
      out.write("<p><span class=\"STYLE1\">学生信息</span></p>\r\n");
      out.write("<table width=\"695\" border=\"0\">\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td width=\"125\" height=\"27\"><form id=\"form3\" name=\"form3\" method=\"post\" action=\"leftmessage.jsp\">\r\n");
      out.write("      <label>\r\n");
      out.write("        <input type=\"checkbox\" name=\"checkbox3\" value=\"checkbox3\" />\r\n");
      out.write("        <span class=\"STYLE5\"><strong>全选</strong></span></label>\r\n");
      out.write("      <label>\r\n");
      out.write("      <input type=\"submit\" name=\"Submit2\" value=\"删除\" />\r\n");
      out.write("      </label>\r\n");
      out.write("    </form>    </td>\r\n");
      out.write("    <td width=\"140\"><div align=\"center\"><span class=\"STYLE4\">姓名</span></div></td>\r\n");
      out.write("    <td width=\"148\"><div align=\"center\"><span class=\"STYLE4\">密码</span></div></td>\r\n");
      out.write("    <td width=\"131\"><div align=\"center\" class=\"STYLE6\">成绩</div></td>\r\n");
      out.write("    <td width=\"129\"><div align=\"center\"><span class=\"STYLE4\">操作</span></div></td>\r\n");
      out.write("  </tr>\r\n");
      out.write(" \r\n");
      out.write("    ");

   
          try{
          
          str="select * from login";
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          con=DriverManager.getConnection("jdbc:odbc:xing");
          pre=con.prepareStatement(str);
          set=pre.executeQuery();
        while(set.next())
            { 
              a3=set.getInt(1);
              a2=set.getString(2);
              a1=set.getString(3);
              a4=set.getString(4);
              
      
      out.write("\r\n");
      out.write("     <tr>  \r\n");
      out.write("    <td height=\"27\"><form id=\"form4\" name=\"form4\" method=\"post\" action=\"\">\r\n");
      out.write("      <label>\r\n");
      out.write("        <input type=\"checkbox\" name=\"checkbox4\" value=\"checkbox\" />\r\n");
      out.write("        <span class=\"STYLE2\">        选择</span></label>\r\n");
      out.write("    </form>    </td>\r\n");
      out.write("    <td><div align=\"center\" class=\"STYLE6\">");
      out.print(a1);
      out.write("</div></td>\r\n");
      out.write("    <td><div align=\"center\" class=\"STYLE4\">");
      out.print(a2);
      out.write("</div></td>\r\n");
      out.write("    <td bgcolor=\"#FFFFFF\"><div align=\"center\" class=\"STYLE4\">");
      out.print(a4);
      out.write("</div></td>\r\n");
      out.write("    <td><div align=\"center\" class=\"STYLE6\"><a href=\"stuxiugai.jsp?id3=");
      out.print(a3);
      out.write("\">修改</a>/<a href=\"leftmessage.jsp?id4=");
      out.print(a3);
      out.write("\">删除</a></div></td>\r\n");
      out.write("  </tr>\r\n");
      out.write("   ");

    }
       set.close();
          pre.close();
          con.close();
          }catch(Exception e)
          {
             out.println(e.getMessage());
              }
      
      out.write("\r\n");
      out.write("</table>\r\n");
      out.write("<p>&nbsp;</p>\r\n");
      out.write("<p>&nbsp;</p>\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}

⌨️ 快捷键说明

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