main.jsp
资源名称:文件管理系统.zip [点击查看]
上传用户:kzxteda
上传日期:2007-06-01
资源大小:54k
文件大小:3k
源码类别:
家庭/个人应用
开发平台:
Java
- <%@ page contentType="text/html; charset=gb2312"%>
- <%@ page language="java" %>
- <%@ page import="java.io.*"%>
- <%
- String strid = request.getParameter("id");
- byte[] tmpbyte = strid.getBytes("ISO8859_1");
- strid = new String(tmpbyte); %>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html">
- <title>无标题文档</title>
- <link rel="stylesheet" href="../css/style.css" type="text/css">
- </head>
- <script language="JavaScript" type="text/JavaScript">
- function subb() {
- if(document.form1.title.value==""){
- alert("请填写要增加的名称!!");
- }
- else
- {
- document.form1.action="mdrd.jsp"
- form1.submit();
- }
- }
- </script>
- <body>
- <FORM METHOD=POST ACTION=""name="form1">
- <input name="title" type="text" id="title">
- <input type="button" name="Submit" value="增加一个文件夹" onClick="subb()">
- <input type="hidden" name="id" value="<%=strid%>">
- <a href="UploadPage.jsp?id=<%=strid%>">上传一个文件或图片</a> <a href="javascript:history.go(-1)">后退</a> <a href="javascript:history.go(1)">前进</a>
- </FORM>
- <table width="80%" bordercolor="#FFFFFF" border="1" bordercolorlight="#000000" bordercolordark="#ffffff" bgcolor="#e1e1e1" cellpadding="1" cellspacing="1">
- <tr>
- <td width="4%"> </td>
- <td width="31%">名称</td>
- <td colspan="2">操作</td>
- </tr>
- <%
- //取得目前目录的磁盘目录
- String path = request.getRealPath(strid);
- //建立代表目前目录位置的d变量
- File d = new File(path);
- //取得代表目录中所有文件
- File list[] = d.listFiles();
- for(int i=0; i < list.length; i++)
- {
- if(list[i].isDirectory()){
- %>
- <tr>
- <td width="4%" height="23"><img src="../img/FolderClosed.gif" width="19" height="16"></td>
- <td width="31%" height="23"><a href="../<%=strid+"/"+list[i].getName() %>?id=<%= list[i].getName() %>"></a><a href="main.jsp?id=<%=strid+"/"+list[i].getName() %>"><%= list[i].getName() %></a></td>
- <td width="31%" height="23">修改</td>
- <td width="34%" height="23"> </td>
- </tr>
- <%}else{}}%>
- <%for(int i=0; i < list.length; i++)
- {
- if(list[i].isDirectory()){}else{
- %>
- <tr>
- <td width="4%"><img src="../img/file_htm.gif" width="15" height="16"></td>
- <td width="31%"><a href="<%="../filemag/ReadAll.jsp?filename="+list[i].getName()+"&path="+strid+""%>"><%= list[i].getName() %></a></td>
- <td width="31%"><a href="rename.jsp?id=<%=strid+"/"+list[i].getName()%>&filename=<%=list[i].getName()%>&path=<%=strid%>&doid=2">修改</a></td>
- <td width="34%"><a href="CreateDelete.jsp?id=<%=strid+"/"+list[i].getName()%>&filename=<%=list[i].getName()%>&path=<%=strid%>&doid=1" onClick="return confirm('您确定删除吗?')">删除</a></td>
- </tr>
- <%}}%>
- </table>
- </body>
- </html>