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

📄 carryout_jsp.java

📁 学生信息管理系统
💻 JAVA
字号:
package org.apache.jsp;

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

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

  private static java.util.Vector _jspx_dependants;

  public java.util.List 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 HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
      Database.accessDB accessDB = null;
      synchronized (_jspx_page_context) {
        accessDB = (Database.accessDB) _jspx_page_context.getAttribute("accessDB", PageContext.PAGE_SCOPE);
        if (accessDB == null){
          accessDB = new Database.accessDB();
          _jspx_page_context.setAttribute("accessDB", accessDB, PageContext.PAGE_SCOPE);
        }
      }
      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html;charset=gb2312\">\r\n");
      out.write("<meta http-equiv=\"refresh\" content=\"3;URL=Student_info.jsp\">\r\n");
      out.write("<title>执行操作</title>\r\n");
      out.write("<style type=\"text/css\">\r\n");
      out.write("<!--\r\n");
      out.write(".style2 {\r\n");
      out.write("      font-size:x-large;\r\n");
      out.write("      font-weight:bold;\r\n");
      out.write("  }\r\n");
      out.write("-->\r\n");
      out.write("</style>\r\n");
      out.write("</head>\r\n");

  String operation="";
  String S_no="";
  String Name="";
  String Sex="";
  String Politic="";
  String Department="";
  String Come="";
  String Birth="";
  String Memo="";
  ResultSet rs=null;
  //获取从student_info.jsp页面传来的operation变量值
  operation=request.getParameter("operation");
  S_no=request.getParameter("S_no");
  //将获得的变量Name的值转换成8859字符集
  Name=new String(request.getParameter("Name").getBytes("8859_1"));
  Sex=new String(request.getParameter("Sex").getBytes("8859_1"));
  Politic=new String(request.getParameter("Politic").getBytes("8859_1"));
  Department=new String(request.getParameter("Department").getBytes("8859_1"));
  Come=new String(request.getParameter("Come").getBytes("8859_1"));
  Birth=request.getParameter("Birth");
  Memo=new String(request.getParameter("Memo").getBytes("8859_1"));

      out.write("\r\n");
      out.write("<body>\r\n");
      out.write("<div align=\"center\">\r\n");
      out.write("  ");

    //如果为新增操作
    if(operation.equals("add")){
      try{
        String sql="insert into tb_student values('"+S_no+"','"+Name+"','"+Sex+"','"+Politic+"','"+Department+"','"+Come+"','"+Birth+"','"+Memo+"')";
        //执行新增sql操作
        accessDB.executeQuery(sql);
        
      out.write("\r\n");
      out.write("        <span class=\"style2\">新增一条信息成功!3秒后自动返回。</span>\r\n");
      out.write("        ");

        }
        catch(Exception e){
        }
  }
      //如果为修改操作
      else if(operation.equals("modify")){
        try{
          String sql="update tb_student set Name='"+Name+"',Sex='"+Sex+"',Politic='"+Politic+"',Department='"+Department+"',Come='"+Come+"',Birth='"+Birth+"',Memo='"+Memo+"' where S_no='"+S_no+"'";
          accessDB.executeQuery(sql);
        
      out.write("\r\n");
      out.write("        <span class=\"style2\">修改一条信息成功!3秒后自动返回。</span>\r\n");
      out.write("        ");

        }
        catch(Exception e){
        }
      }
        //如果为删除操作
        else if(operation.equals("del")){
        try {
        String sql="delete* from tb_student where S_no='"+S_no+"'";
        accessDB.executeQuery(sql);
        
      out.write("\r\n");
      out.write("        <span class=\"style2\">删除一条信息成功!3秒后自动返回。</span>\r\n");
      out.write("        ");

         }
         catch(Exception e){
         }
        }
        
      out.write("\r\n");
      out.write("      </div>\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 + -