2024/02/27

package org.example.schooltest;

import DAO.SchoolDAO;
import DAO.liushuiDAO;
import bean.LiuShui;
import bean.School;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;

import java.io.IOException;
import java.util.List;
@WebServlet(value="/tijiao-servlet")
public class TijiaoServlet extends HttpServlet {
    private String zhuanye;
    private String zongfen;
    private String math;
    private String english;
    private String zhengzhi;
    private String zy;
    private String schoolid;
    private String stuid;
    private String teaid;
    private String name;
    private LiuShui liuShui;
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
        liuShui=new LiuShui();
        schoolid= request.getParameter("schoolid");
        stuid=request.getParameter("stuid");
        teaid=request.getParameter("teaid");
        name=request.getParameter("name");
        zhuanye=request.getParameter("zhuanye");
        zongfen=request.getParameter("zongfen");
        math=request.getParameter("math");
        zhengzhi=request.getParameter("zhengzhi");
        english=request.getParameter("english");
        zy=request.getParameter("zy");
        liuShui.setEnglish(english);
        liuShui.setZhengzhi(zhengzhi);
        liuShui.setMath(math);
        liuShui.setSchoolid(schoolid);
        liuShui.setZhuanye(zhuanye);
        liuShui.setZongfen(zongfen);
        liuShui.setZy(zy);
        liuShui.setStuid(stuid);
        liuShui.setSchoolid(schoolid);
        liuShui.setName(name);
        liushuiDAO hhh=new liushuiDAO();
        hhh.insert(liuShui);
        response.sendRedirect("main.jsp");
    }
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
        response.setContentType("text/html");
        doGet(request,response);
    }
}

 

posted @ 2024-02-28 19:44  伐木工熊大  阅读(2)  评论(0编辑  收藏  举报