send_msg_process.jsp
资源名称:NetOffice.rar [点击查看]
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:4k
源码类别:
电子政务应用
开发平台:
Java
- <%@ page errorPage="/vnex/ErrorPage.jsp" %>
- <%@ page import="java.util.Vector"%>
- <%@ page import="com.vnex.intranet.communication.message.value.*" %>
- <%@ page import="com.vnex.intranet.system.loader.ConfigParaLoader"%>
- <%@ page import="com.vnex.intranet.util.SubPathGenerater" %>
- <jsp:useBean id="msgProxy" scope="application" class="com.vnex.intranet.communication.message.proxy.MessageProxyBean" />
- <jsp:useBean id="mvb" scope="request" class="com.vnex.intranet.communication.message.value.MessageValueBean" />
- <jsp:useBean id="BusinessName" scope="session" class="com.vnex.intranet.pub.BusinessSession" />
- <jsp:useBean id="mySmartUpload" scope="request" class="com.vnex.intranet.upload.SmartUpload" />
- <jsp:setProperty name="mvb" property="*" />
- <%
- String root = ConfigParaLoader.getParameter("rootUrl");
- //out.println("root:="+root);
- String fileSaveRoot = root+"/"+ConfigParaLoader.getParameter("msgAttachmentUrl")+"/";
- String subPath = SubPathGenerater.getSubPath( fileSaveRoot);
- fileSaveRoot += subPath;
- //yuduan add begin
- String fileSaveRootSever = "/"+ConfigParaLoader.getParameter("msgAttachmentUrl")+"/";
- fileSaveRootSever += subPath;
- //out.println("fileSaveRootSever="+fileSaveRootSever);
- //yuduan over
- mySmartUpload.initialize( pageContext );
- mySmartUpload.setTotalMaxFileSize(ConfigParaLoader.getParameterByInt("attachmentSize"));
- mySmartUpload.upload();
- Vector fName = new Vector();
- for(int i=0;i<mySmartUpload.getFiles().getCount();i++)
- {
- com.vnex.intranet.upload.File myFile = mySmartUpload.getFiles().getFile(i);
- if(!myFile.isMissing())
- {
- //out.println("fileSaveRoot="+fileSaveRoot);//
- myFile.saveAs(fileSaveRoot+"/"+myFile.getFileName());
- fName.add(fileSaveRootSever+"/"+myFile.getFileName());
- }
- }
- String[] fileNames = null;
- if(fName.size() > 0)
- {
- fileNames = new String[fName.size()];
- fName.toArray(fileNames);
- }
- String[] ids = mySmartUpload.getRequest().getParameterValues("receiverArray");
- if(ids != null)
- {
- int[] receiverIds = new int[ids.length];
- for(int i=0;i<ids.length;i++)
- {
- receiverIds[i] = Integer.parseInt(ids[i]);
- }
- mvb.setReceiverIds(receiverIds);
- }
- mvb.setMsgTitle(mySmartUpload.getRequest().getParameter("msgTitle"));
- mvb.setMsgBody(mySmartUpload.getRequest().getParameter("msgBody"));
- mvb.setEmpId(BusinessName.getEmpId());
- mvb.setSenderId(BusinessName.getEmpId());
- mvb.setIsSent(1);
- Vector vect = new Vector();
- if(fileNames != null)
- {
- for(int i=0;i<fileNames.length;i++)
- {
- MsgAttachmentValueBean bean = new MsgAttachmentValueBean();
- bean.setFileLocation(fileNames[i]);
- //out.println("this is a good:"+fileNames[i]);
- bean.setCounter(ids.length);
- vect.add(bean);
- }
- }
- if(request.getParameter("resend") != null)
- {
- String[] resendFileLocation = mySmartUpload.getRequest().getParameterValues("fileLocations");
- if(resendFileLocation != null)
- {
- //out.println("find resend");
- for(int i=0;i<resendFileLocation.length;i++)
- {
- MsgAttachmentValueBean bean = new MsgAttachmentValueBean();
- bean.setFileLocation(resendFileLocation[i]);
- bean.setCounter(ids.length);
- vect.add(bean);
- //out.println("fileLocation="+resendFileLocation[i]);///
- }
- }
- }
- //out.println("vect.size()="+vect.size());///
- mvb.setAttachment(vect);
- msgProxy.sendMessage(mvb);
- %>
- <html>
- <head>
- <script language=javascript>
- function forward()
- {
- document.location = "/mainctrl/msg/sentHome";
- }
- </script>
- </head>
- <body onload="javascript:forward()">
- </body>
- </html>