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

📄 gbs_mifuploadfileaction.java

📁 对日软件外包 为东芝做的一个全球商业管理系统
💻 JAVA
字号:
/*
 * GBS_MifUploadFileAction.java
 * 
 * Date: 2004/09/15
 * Author: gxk
 * Version: 1.0
 */
package ACTION;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import COMMON.BaseDispatchAction;
import COMMON.MessageList;
import COMMON.ReturnValue;
import LOGIC.GBS_MifUploadFileActionLogic;

/**
 * @author gxk
 * @date 2004/09/15
 */
public class GBS_MifUploadFileAction extends BaseDispatchAction {

	public ActionForward add(
		ActionMapping mapping,
		ActionForm requestForm,
		HttpServletRequest request,
		HttpServletResponse response)
		throws Exception {

		GBS_MifUploadFileForm form = (GBS_MifUploadFileForm) requestForm;

		//get login user info from session
		this.setUserInfoFromSession(request, form);

		//input Check
		MessageList messages = new MessageList();
		boolean isError = false;
		if (form.getAttachmentFile() == null
			|| form.getAttachmentFile().getFileName().equals("")
			|| form.getAttachmentFile().getFileSize() == 0) {
			messages.setMessage(
				"attachmentFile",
				null,
				"10000012",
				Integer.MIN_VALUE,
				new Object[] { "AttachmentFile" },
				"AttachmentFile");
			isError = true;
		} else if (form.getAttachmentFile().getFileName().length() > 100) {
			messages.setMessage("attachmentFile", "", "10000018", Integer.MIN_VALUE);
			isError = true;
		}
		if (isError) {
			this.setMessage(messages);
			return mapping.findForward(nextview);
		}

		//Save file to DB temp table and get the file name and the seqNo
		GBS_MifUploadFileActionLogic logic = new GBS_MifUploadFileActionLogic(this.getDataSource(request));
		ReturnValue returnValue =
			logic.addAttachmentFileIntoTempTable(
				request.getSession().getId(),
				form.getLoginUserId(),
				form.getAttachmentFile());
		if (returnValue.isError()) {
			if (returnValue.isBussinessError()) {
				this.setMessage(returnValue.getMessageList());
			}
			//getErrorCode getErrorMessage proc
			return (mapping.findForward(nextview));
		} else {
			int iSeqNo = ((Integer) returnValue.getDataValue()).intValue();
			form.setFileName(form.getAttachmentFile().getFileName());
			form.setSeqNo(String.valueOf(iSeqNo));
			form.setMethod("close");
		}
		return mapping.findForward(nextview);
	}
	public ActionForward init(
		ActionMapping mapping,
		ActionForm requestForm,
		HttpServletRequest request,
		HttpServletResponse response)
		throws Exception {

		GBS_MifUploadFileForm form = (GBS_MifUploadFileForm) requestForm;

		//get login user info from session
		this.setUserInfoFromSession(request, form);
		
		form.setMethod("add");

		return mapping.findForward(nextview);
	}

}

⌨️ 快捷键说明

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