|
|
package web.servlet.notify;
|
|
|
|
|
|
import domain.Student;
|
|
|
import service.NotifyService;
|
|
|
import service.impl.NotifyServiceImpl;
|
|
|
|
|
|
import javax.servlet.ServletException;
|
|
|
import javax.servlet.annotation.WebServlet;
|
|
|
import javax.servlet.http.HttpServlet;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
import java.io.IOException;
|
|
|
/**
|
|
|
* 删除通知的Servlet
|
|
|
*/
|
|
|
@WebServlet("/deleteNotifyServlet")
|
|
|
public class DeleteNotifyServlet extends HttpServlet {
|
|
|
/**
|
|
|
* 处理POST请求,删除指定ID的通知。
|
|
|
*
|
|
|
* @param request HTTP请求对象,包含客户端发送的数据。
|
|
|
* @param response HTTP响应对象,用于生成返回给客户端的响应。
|
|
|
* @throws ServletException 如果处理请求时发生错误。
|
|
|
* @throws IOException 如果输入或输出异常发生。
|
|
|
*/
|
|
|
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
|
// 设置请求的字符编码为UTF-8,以支持中文字符的正确处理
|
|
|
request.setCharacterEncoding("utf-8");
|
|
|
HttpSession session = request.getSession();
|
|
|
String notifyid = request.getParameter("id");
|
|
|
NotifyService service = new NotifyServiceImpl();
|
|
|
service.deleteNotifyById(notifyid);
|
|
|
request.getRequestDispatcher("/notifyListServlet").forward(request,response);
|
|
|
}
|
|
|
|
|
|
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
|
|
doPost(request,response);
|
|
|
}
|
|
|
}
|