package course;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

@WebServlet("/courseDeleteAction")
public class courseDeleteAction extends HttpServlet {
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int id = Integer.parseInt(req.getParameter("id"));
        courseDB coursedb = new courseDB();
        coursedb.deleteCourse(id);
        String path = req.getContextPath();
        resp.sendRedirect(path+"/course/course.jsp");
    }
}
