address_list_export.jsp
资源名称:NetOffice.rar [点击查看]
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:8k
源码类别:
电子政务应用
开发平台:
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.system.loader.ConfigParaLoader"%>
- <%@ page import="com.vnex.intranet.util.*"%>
- <%@ 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" />
- <%
- String contactName = "";
- String nickName = "";
- String birthday = "";
- String gender = "";
- String emailAddress = "";
- String anotherEmail = "";
- String personalUrl = "";
- String oicqNum = "";
- String pagerNum = "";
- String mobileNum = "";
- String homeAddress = "";
- String homePC = "";
- String homeTeleNum = "";
- String unit = "";
- String position = "";
- String unitAddress = "";
- String unitTeleNum = "";
- String unitPC = "";
- String unitFaxNum = "";
- String notes = "";
- FileWriter resultsFile = null;
- String root = ConfigParaLoader.getParameter("rootUrl");
- if( request.getParameter("export")!=null && request.getParameter("export").equals("ok") )
- {
- try
- {
- int empId = BusinessName.getEmpId();
- Collection coll = null;
- String condition = " where emp_id="+empId;;
- coll = addressProxy.getContactList(condition);
- AddresslistValueBean alvb = null;
- //是否目录存在
- File f = new File(root+"\CSVFile\");
- if(!f.isDirectory())
- {
- f.mkdir();
- }
- resultsFile = new FileWriter(root+"\CSVFile\NetOffice"+BusinessName.getEmpId()+".csv");
- PrintWriter toFile = new PrintWriter(resultsFile);
- toFile.println(""姓名","昵称","生日","性别","电子邮件地址","备用邮件地址","个人 Web 页","OICQ","寻呼机","移动电话","家庭地址","家庭所在地的邮政编码","家庭电话","工作单位","职务","单位地址","单位电话","单位邮编","单位传真","备注"");
- if(coll != null && coll.size() != 0)
- {
- Iterator it = coll.iterator();
- while( it.hasNext() )
- {
- alvb = (AddresslistValueBean)it.next();
- if(alvb.getContactName()!=null)
- contactName = alvb.getContactName();
- if(alvb.getNickName()!=null)
- nickName = alvb.getNickName();
- if(alvb.getBirthday()!=null)
- {
- Timestamp tt = TimeStamp.convertCalendarToTimestamp(alvb.getBirthday());
- birthday = MyDateFormat.myDate(tt);
- }
- if(alvb.getGender()==0)
- gender = "男";
- if(alvb.getGender()==1)
- gender = "女";
- if(alvb.getEmailAddress()!=null)
- emailAddress = alvb.getEmailAddress();
- if(alvb.getAnotherEmail()!=null)
- anotherEmail = alvb.getAnotherEmail();
- if(alvb.getPersonalUrl()!=null)
- personalUrl = alvb.getPersonalUrl();
- if(alvb.getOicqNum()!=null)
- oicqNum = alvb.getOicqNum();
- if(alvb.getPagerNum()!=null)
- pagerNum = alvb.getPagerNum();
- if(alvb.getMobileNum()!=null)
- mobileNum = alvb.getMobileNum();
- if(alvb.getHomeAddress()!=null)
- homeAddress = alvb.getHomeAddress();
- if(alvb.getHomePC()!=null)
- homePC = alvb.getHomePC();
- if(alvb.getHomeTeleNum()!=null)
- homeTeleNum = alvb.getHomeTeleNum();
- if(alvb.getUnit()!=null)
- unit = alvb.getUnit();
- if(alvb.getPosition()!=null)
- position = alvb.getPosition();
- if(alvb.getUnitAddress()!=null)
- unitAddress = alvb.getUnitAddress();
- if(alvb.getUnitTeleNum()!=null)
- unitTeleNum = alvb.getUnitTeleNum();
- if(alvb.getUnitPC()!=null)
- unitPC = alvb.getUnitPC();
- if(alvb.getUnitFaxNum()!=null)
- unitFaxNum = alvb.getUnitFaxNum();
- if(alvb.getNotes()!=null)
- notes = alvb.getNotes();
- toFile.println("""+contactName+"",""+nickName+"","+
- """+birthday+"",""+gender+"","+
- """+emailAddress+"",""+anotherEmail+"","+
- """+personalUrl+"",""+oicqNum+"","+
- """+pagerNum+"",""+mobileNum+"","+
- """+homeAddress+"",""+homePC+"","+
- """+homeTeleNum+"",""+unit+"","+
- """+position+"",""+unitAddress+"","+
- """+unitTeleNum+"",""+unitPC+"","+
- """+unitFaxNum+"",""+notes+""");
- contactName = "";
- nickName = "";
- birthday = "";
- gender = "";
- emailAddress = "";
- anotherEmail = "";
- personalUrl = "";
- oicqNum = "";
- pagerNum = "";
- mobileNum = "";
- homeAddress = "";
- homePC = "";
- homeTeleNum = "";
- unit = "";
- position = "";
- unitAddress = "";
- unitTeleNum = "";
- unitPC = "";
- unitFaxNum = "";
- notes = "";
- }
- }
- resultsFile.close();
- }
- catch(Exception e)
- {
- System.out.println("e:"+e);
- }
- }
- %>
- <!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 exportt()
- {
- document.myform.action = "/mainctrl/addressbook/export?export=ok";
- 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>
- <%
- if( request.getParameter("export")!=null && request.getParameter("export").equals("ok") )
- {
- %>
- <a href="/CSVFile/NetOffice<%= BusinessName.getEmpId()%>.csv" target="_blank"><font color="#0000FF">NetOffice.csv</font></a>
- <%
- }
- %>
- </td>
- <tr bgcolor="#fafafa" height="30">
- <td colspan="2" align="center">
- <input type="button" name="Button2" value="导出" onClick="exportt()" 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>