ManageDelServlet.java
上传用户:liangcc
上传日期:2019-05-24
资源大小:4412k
文件大小:2k
- package com.softeem.webmail.delbox;
- import java.io.IOException;
- import java.io.PrintWriter;
- import javax.servlet.ServletException;
- import javax.servlet.http.HttpServlet;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import javax.servlet.http.HttpSession;
- import com.softeem.webmail.dao.mail.DeleteMail;
- import com.softeem.webmail.dao.mail.Mail;
- import com.softeem.webmail.dao.mail.MailDAO;
- import com.softeem.webmail.dao.mail.MoveMail;
- public class ManageDelServlet extends HttpServlet {
-
- public void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- doPost(request, response);
- }
- public void doPost(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- response.setContentType("text/html");
- PrintWriter out = response.getWriter();
- String box_name = request.getParameter("newBox");
- String method = request.getParameter("easyJWebCommand");
- System.out.println(method + "操作类型" + box_name + "<><><><>");
- //邮件转移到其他邮箱
- if("move".equalsIgnoreCase(method)){
- String ids = request.getParameter("cid");
- String[] id = ids.split(",");
- for (String str : id) {
- int mail_id = Integer.parseInt(str);
- MoveMail.MoveMailByBoxname(box_name, mail_id);
- }
- response.sendRedirect("DelboxServlet");
- }
- //邮件回复
- if ("reply".equalsIgnoreCase(method)) {
- String id = request.getParameter("cid");
- System.out.println(id+"==cid中的值为");
- int mail_id = Integer.parseInt(id);
- System.out.println(mail_id+"===mail_id的值为");
- Mail mail = MailDAO.getMailById(mail_id);
- HttpSession session = request.getSession(false);
- //放入session中的Mail对象 其别名为replymail
- session.setAttribute("replymail", mail);
- System.out.println("得到了mail");
- response.sendRedirect("write.jsp");
- }
-
- if("forward".equalsIgnoreCase(method)){
- String id = request.getParameter("cid");
- System.out.println(id+"==cid中的值为");
- int mail_id = Integer.parseInt(id);
- System.out.println(mail_id+"===mail_id的值为");
- Mail mail = MailDAO.getMailById(mail_id);
- HttpSession session = request.getSession(false);
- session.setAttribute("forwardmail", mail);
- System.out.println("得到了mail");
- response.sendRedirect("write.jsp");
-
- }
-
-
- }
- }