?? gbs_mifuploadfileaction.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 + -