address_list_import.jsp
资源名称:NetOffice.rar [点击查看]
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:6k
源码类别:
电子政务应用
开发平台:
Java
- <%@ page errorPage="/vnex/ErrorPage.jsp" %>
- <%@ page import="com.vnex.intranet.addresslist.value.*"%>
- <%@ page import="com.vnex.intranet.addresslist.proxy.*"%>
- <%@ page import="com.vnex.intranet.addresslist.handler.*"%>
- <%@ page import="com.vnex.intranet.system.loader.ConfigParaLoader"%>
- <%@ page import="com.vnex.intranet.util.*"%>
- <%@ page import="com.vnex.intranet.upload.*"%>
- <%@ page import="java.util.*" %>
- <%@ page import="java.sql.*" %>
- <%@ page import="java.io.*" %>
- <jsp:useBean id="addressProxy" class="com.vnex.intranet.addresslist.proxy.AddressProxyBean" scope="application" />
- <jsp:useBean id="BusinessName" scope="session" class="com.vnex.intranet.pub.BusinessSession" />
- <jsp:useBean id="myUpload" scope="page" class="com.vnex.intranet.upload.SmartUpload" />
- <%
- if( request.getParameter("import") !=null && request.getParameter("import").equals("ok") ) //上载
- {
- System.out.println("ok");
- String root = ConfigParaLoader.getParameter("rootUrl");
- System.out.println(root);
- // Initialization
- myUpload.initialize( pageContext );
- myUpload.setTotalMaxFileSize( Integer.parseInt(ConfigParaLoader.getParameter("attachmentSize")) );
- System.out.println(root);
- System.out.println(Integer.parseInt(ConfigParaLoader.getParameter("attachmentSize")));
- // Only allow txt or htm files
- // myUpload.setAllowedFilesList("csv,CSV");
- //是否目录存在
- java.io.File f = new java.io.File(root+"\CSVFile\");
- if(!f.isDirectory())
- {
- f.mkdir();
- }
- // Upload
- myUpload.upload();
- com.vnex.intranet.upload.File myFile = myUpload.getFiles().getFile(0);
- myFile.saveAs( root+"/CSVFile/NetOffice_Im.csv" );
- RandomAccessFile outFile = new RandomAccessFile( root+"/CSVFile/NetOffice_Im.csv","r" );
- com.vnex.intranet.upload.Request multi = myUpload.getRequest();
- AddressCSVHandler.csvToDB(outFile, BusinessName.getEmpId(), Integer.parseInt(multi.getParameter("csv")));
- outFile.close();
- //response.sendRedirect("/mainctrl/addressbook/home");
- }
- %>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <HTML>
- <jsp:include page="/vnex/page/FORM_HEAD.jsp" />
- <BODY text=#000000 vLink=#000000 aLink=#000000 link=#000000 bgColor=#ffffff topMargin=20 leftmargin="0" marginwidth="0" marginheight="0">
- <script language="javascript" src="/vnex/validate.js" ></script>
- <script language="JavaScript">
- function check()
- {
- if(document.myform.file.value.toLowerCase().indexOf(".csv")==-1)
- {
- alert("导入的文件必须是csv格式的文件。");
- document.myform.file.focus();
- return false;
- }
- return true;
- }
- function importt()
- {
- if(!check())
- {
- return false;
- }
- document.myform.action = "/mainctrl/addressbook/import?import=ok";
- myform.encoding="multipart/form-data";
- document.myform.submit();
- }
- </script>
- <script language="JavaScript1.2" src="/vnex/menu/dockmenu_person.js"></script>
- <script language="JavaScript" src="/vnex/menu/dockmenu.js"></script>
- <DIV align=center>
- <form name="myform" method="post" action="">
- <TABLE class=outter cellSpacing=0 cellPadding=0 width=600 border=0>
- <jsp:include page="/vnex/page/TTOA_TABLE_TOP.jsp" />
- <TR>
- <TD colSpan=3 align="center"><br>
- <table width="600" border="1" cellspacing="1" bordercolor="#666666">
- <tr>
- <td align="center" colspan="2" bgcolor="#FFFFFF">
- <table width="600" border="0" cellspacing="0" cellpadding="0">
- <tr bgcolor="#666666">
- <td colspan="2"><font class="strongw"><a href="/mainctrl/home/index"><font color="#ffffff">主页</font></a>>><a href="/mainctrl/personal/main"><font color="#ffffff">个人办公</font></a>>><a href="/mainctrl/addressbook/home"><font color="#ffffff">个人通讯录</font></a>>>导入</font>
- </td>
- </tr>
- </table>
- <table class=title border="0" cellpadding="2" cellspacing="1" width="600">
- <tr bgcolor="#e0e0e0">
- <td width="15%"><strong> 说明:</strong></td>
- <td><a href="/mainctrl/addressbook/help"><font color="#0000FF">导入导出说明</font></a>
- </td>
- </tr>
- <tr bgcolor="#fafafa">
- <td width="15%"><strong> 导入格式:</strong></td>
- <td>
- <input type="radio" value="1" name="csv" checked>导入Net-Office格式的csv文件<br>
- <input type="radio" value="0" name="csv">导入Outlook格式的csv文件
- </td>
- </tr>
- <tr bgcolor="#e0e0e0">
- <td width="15%"><strong> 文件:</strong></td>
- <td><input type="file" name="file" class="text"></td>
- </tr>
- <tr bgcolor="#fafafa" height="30">
- <td colspan="2" align="center">
- <input type="button" name="Button2" value="导入" onClick="importt()" class="text">
-
- <input type="button" name="Button3" value="返回" onClick="location='/mainctrl/addressbook/home'" class="text">
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <jsp:include page="/vnex/page/TTOA_HELP.jsp" />
- </TD>
- </TR>
- <jsp:include page="/vnex/page/TTOA_TABLE_BOTTOM.jsp" />
- </TABLE>
- <br>
- <jsp:include page="/vnex/page/TTOA_PRODUCER_LOGO.jsp" />
- </form></DIV>
- </BODY></HTML>