bak_file.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:3k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=gb2312" %>
  2. <%@ include file="../inc/inc.jsp" %>
  3. <%@ page import="java.net.URL" %>
  4. <jsp:useBean id="fchar" scope="page" class="cn.js.fan.util.StrUtil"/>
  5. <html><head>
  6. <meta http-equiv="pragma" content="no-cache">
  7. <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
  8. <meta http-equiv="expires" content="wed, 26 Feb 1997 08:21:57 GMT">
  9. <title>部门管理</title>
  10. <link rel="stylesheet" href="../common.css">
  11. <script language="JavaScript">
  12. <!--
  13. //-->
  14. </script>
  15. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  16. <body bgcolor="#FFFFFF" topmargin='5' leftmargin='0'>
  17. <jsp:useBean id="cfgparser" scope="page" class="fan.util.CFGParser"/>
  18. <jsp:useBean id="compress" scope="page" class="fan.util.Compress"/>
  19. <jsp:useBean id="ffile" scope="page" class="fan.util.FFile"/>
  20. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  21. <jsp:setProperty name="privilege" property="defaulturl" value="../index.jsp"/>
  22. <!--重定向至 :<jsp:getProperty name="privilege" property="defaulturl"   />-->
  23. <table width="494" border="0" align="center" cellpadding="0" cellspacing="0">
  24.   <tr> 
  25.     <td height="23" valign="bottom" background="../images/tab-b5-top.gif">     <span class="right-title">系 统 备 份</span></td>
  26.   </tr>
  27.   <tr> 
  28.     <td height="310" valign="top" background="../images/tab-b-back.gif">
  29.         <%
  30. String priv="admin.bak";
  31. if (!privilege.isUserPrivValid(request,priv))
  32. {
  33.     out.print(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  34. return;
  35. }
  36. %>
  37. <table width="470" border="0" align="center">
  38.         <tr>
  39.           <td>&nbsp;</td>
  40.           <td>&nbsp;</td>
  41.           <td>&nbsp;</td>
  42.         </tr>
  43.         <tr>
  44.           <td>&nbsp;</td>
  45.           <td align="center">
  46.   <%
  47.     String srcpath = application.getRealPath("/") + "upfile/";
  48. cfgparser.parse("config.xml");
  49.     Properties props = cfgparser.getProps();
  50.     String despath = props.getProperty("bak_path");
  51. ffile.copyDirectory(despath+"/file",srcpath);
  52. out.print(fchar.p_center("备份成功!"));
  53. String zipfilepath = despath+"/bak_file.zip";
  54.     compress.zipDirectory(srcpath, zipfilepath);
  55. out.print(fchar.p_center("压缩ZIP文件成功!"));
  56. //String zipfilepath = application.getRealPath("/")+"WEB-INF/classes/bak/bak_file.zip";
  57.     //compress.zipDirectory(srcpath, zipfilepath);
  58. //在一些Web容器(containers)中,下面代码中的request dispatchers并不能用于静态的资源(如果静态资源不在WEB-INF下,它可以用)。
  59. //在tomcat中下载时则不能自动得到扩展名,即文件类型
  60. //RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/classes/bak/bak_file.zip");
  61. //rd.forward(request, response);
  62. String rootpath = request.getContextPath();
  63.   %>
  64.   <a href="<%=rootpath%>/bak/bak_file.zip">下载ZIP文件</a>   </td>
  65.           <td>&nbsp;</td>
  66.         </tr>
  67.         <tr>
  68.           <td>&nbsp;</td>
  69.           <td>&nbsp;</td>
  70.           <td>&nbsp;</td>
  71.         </tr>
  72.       </table>
  73.   <br>
  74.     </td>
  75.   </tr>
  76.   <tr> 
  77.     <td height="9"><img src="../images/tab-b-bot.gif" width="494" height="9"></td>
  78.   </tr>
  79. </table>
  80. </body>                                        
  81. </html>                            
  82.