⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updatefileaction.java

📁 办公自动化项目
💻 JAVA
字号:
package com.t60.oa.doc.struts;

import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.Action;
import com.t60.oa.common.util.HttpSessionUtil;
import com.t60.oa.doc.service.*;
import hong.javanet.dao.HibernateAspect;
import java.util.*;
import java.io.UnsupportedEncodingException;

public class UpdatefileAction extends Action {
    public ActionForward execute(ActionMapping mapping, ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response) throws
            UnsupportedEncodingException {
        UpdatefileForm updatefileForm = (UpdatefileForm) form;
        InputFolder updatefile=new InputFolder();
        int userId = HttpSessionUtil.getUserID(request.getSession());
        try {
            updatefileForm.setUserId(new Integer(userId));
            updatefile.setUpform(updatefileForm);
            new HibernateAspect().bind(updatefile, "update").execute();
            System.out.println(updatefileForm.getMethod());
            if (updatefile.getMessage() != null) {
                updatefile.vision(updatefileForm.getPossible(),
                                  updatefileForm.getChosen());
                request.setAttribute("comfile", updatefile);
                request.setAttribute("folderId",updatefileForm.getFolderId());
                request.setAttribute("sireID", updatefileForm.getSireID()); //返回父文件夹ID
                request.setAttribute("filename",new String(updatefileForm.getFilename().
                        getBytes("ISO-8859-1"), "GBK")); //把文件名传给页面使用
                return mapping.findForward("fload");
            } else if(updatefileForm.getMethod().equals("1")){
                updatefile.setFolderId(updatefileForm.getFolderId());
                new HibernateAspect().bind(updatefile, "show").execute();
                request.setAttribute("folderId",request.getParameter("folderId"));
                request.setAttribute("sireID",request.getParameter("sireID"));
                request.setAttribute("filename",new String(request.getParameter("filename").getBytes("ISO-8859-1"),"GBK"));
                request.setAttribute("file",updatefile);
                return mapping.findForward("fload");
            }else if(updatefileForm.getMethod().equals("0")){
                DocumentService ds = new DocumentService();
                Set depId = HttpSessionUtil.getDepId(request.getSession());
                ds.setEmpId(userId);
                ds.setDepartmentId(depId);
                new HibernateAspect().bind(ds, "showAllFolder").execute();
                request.setAttribute("mainResult", ds);
                return mapping.findForward("main");
            }
        }catch (Exception ex) {
            request.setAttribute("message", ex.getMessage());
            updatefile.vision(updatefileForm.getPossible(),
                                  updatefileForm.getChosen());
            request.setAttribute("comfile", updatefile);
            request.setAttribute("folderId",updatefileForm.getFolderId());
            request.setAttribute("sireID", updatefileForm.getSireID());
            request.setAttribute("filename",new String(updatefileForm.getFilename().
                        getBytes("ISO-8859-1"), "GBK"));
            return mapping.findForward("fload");
        }


        throw new java.lang.UnsupportedOperationException(
                "Method $execute() not yet implemented.");
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -