📄 delarchiveaction.java
字号:
/*
*
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
*
*/
package com.stsc.archive.file;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Locale;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.util.MessageResources;
import com.stsc.archive.manage.*;
/**
* Implementation of <strong>Action</strong> that show archive list.
*
* @author Lu Tianxiong
* @version $Revision: 1.0 $ $Date: 2003/04/04 11:56:08 $
*/
public final class delArchiveAction extends Action {
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
System.out.println("mapping.getAttribute(): = " + mapping.getAttribute());
System.out.println("mapping.getScope(): = " + mapping.getScope());
HttpSession session = request.getSession();
ActionErrors errors = new ActionErrors();
//2003-05-20 add by liqf
//取得用户权限
User userInfo = (User)(session.getAttribute(Constants.CURRENT_USER_KEY));
boolean info=userInfo.hasPopedom(6);
//测试用,
//boolean info=true;
//ArchiveList archiveList= new ArchiveList();
//session.setAttribute(Constants.ARCHIVELIST_KEY,archiveList);
// String serialno = request.getParameter("serialno");
//取被选中要删除的档案文件.
String[] temp=request.getParameterValues("serialno");
String action="Delete";
//System.out.println("5555555555555555555555555555");
if(temp!=null ){
Archive arc =new Archive();
for(int i=0;i<temp.length;i++){
if(info==false){
//如果没有删除权限,将删除的数据做标记
arc.marcketFile(temp[i]);
}else{
//先删掉数据库中的数据
arc.save(action,temp[i]);
}
//再清除BEAN中的数据
ArchiveList archiveList = (ArchiveList) session.getAttribute(Constants.ARCHIVELIST_KEY);
arc = archiveList.findArchive(temp[i]);
archiveList.removeArchive(arc);
//System.out.println("temp========"+temp[i]);
}
}
// Report any errors we have discovered back to the original form
if (!errors.empty()) {
saveErrors(request, errors);
return (new ActionForward(mapping.getInput()));
}
//System.out.println("5666666666666666666666666666666666666666");
// Forward control to the specified success URI
System.out.println("mapping.findForward(\"success\")=" + mapping.findForward("success"));
return (mapping.findForward("success"));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -