DeleteBoxAction.java
上传用户:liangcc
上传日期:2019-05-24
资源大小:4412k
文件大小:1k
- package com.softeem.struts.action;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import org.apache.struts.action.Action;
- import org.apache.struts.action.ActionForm;
- import org.apache.struts.action.ActionForward;
- import org.apache.struts.action.ActionMapping;
- import com.softeem.webmail.beans.receive.User;
- import com.softeem.webmail.dao.folder.Delete;
- public class DeleteBoxAction extends Action {
- public ActionForward execute(ActionMapping mapping, ActionForm form,
- HttpServletRequest request, HttpServletResponse response) {
- String boxname = request.getParameter("boxname");
- String username = ((User)request.getSession(false).getAttribute("user")).getUsername();
- // String username = "sad";
- String sql = "";
- if("recbox".equals(boxname)){
- sql = "delete from mail where box_name ='" + boxname + "' and " +"mail_to='" + username + "'";
- }else if("sendbox".equals(boxname)){
- sql = "delete from mail where box_name ='" + boxname + "' and " +"mail_from='" + username + "'";
- }else if("drafts".equals(boxname) || "laji".equals(boxname)){
- sql = "delete from mail where box_name ='" + boxname + "' and " +"(mail_to='" + username + "'or mail_from='"+username+"')";
- }else if("newbox".equals(boxname)){
- sql = "delete from mail where stat = '1' and mail_to='"+username + "'";
- }
- new Delete().deleteBoxByName(sql);
- return mapping.findForward("success");
- }
- }