deletestu.java~12~

来自「基于WEB的作业提交系统,是用JSP,JBUILDER,TOMCAT,MYSQL」· JAVA~12~ 代码 · 共 44 行

JAVA~12~
44
字号
package work.ctrol.ctrolMenager;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import work.info.StuInfo;

public class DeleteStu extends HttpServlet {
    private static final String CONTENT_TYPE = "text/html; charset=GB2312";

    //Initialize global variables
    public void init() throws ServletException {
    }

    //Process the HTTP Get request
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws
            ServletException, IOException {
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        String stuNo1=request.getParameter("stuNo");
        int stuNo=Integer.parseInt(stuNo1);
        StuInfo delStu=new StuInfo();
        String username1="admin";
        String password1="admin";
        delStu.setStuNo(stuNo);
        if(delStu.deletStu()){
            System.out.println("删除成功!");
            getServletContext().getRequestDispatcher("/mlogin?username=username1&password=password1").forward(request,response);
        }
        out.close();
    }

    //Process the HTTP Post request
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws
            ServletException, IOException {
        doGet(request, response);
    }

    //Clean up resources
    public void destroy() {
    }
}

⌨️ 快捷键说明

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