The design idea behind the development of this file is this. Some web sites or B/S software customers often have special requirements for certain details during the installation and debugging stage of the software, perhaps font adjustments, or small changes to the interface. Faced with such a situation, if the user does not open the FTP function, development and maintenance personnel often have to go to the site to do some small debugging work.
That is a waste of time, manpower and material resources.
Under such circumstances, I developed this JSP single-page file with file management functions. It provides the functions of adding, renaming, and deleting folders; modifying, renaming, deleting, and uploading files. It can basically satisfy the small modification work during the installation and debugging stage of the software.
For security reasons, this JSP page provides simple user login functionality.
Before use, place this file in the website file or any directory of the B/S product. Open the read and write permissions for the file installation directory. Users can remotely log in to the JSP page to exercise management functions. After the installation and maintenance phase is completed, please modify the read and write permissions of the file installation directory and delete the file to avoid security risks.
By default, the login user name is: admin and the password is: oddworld
development environment jakarta-tomcat-4.0.3.exe
Note: Because the file upload function of this software must be supported by the smartupload component. Please place smartupload under the web-inf corresponding folder of tomcat. If the components you support uploading are different, please make adjustments yourself.
Brief development instructions: Because this document is not complicated, and I feel that although the document description is not standardized, it is also detailed, so I only intend to briefly explain some small details.
1. When this file performs file directory operations, the directory is passed directly as a parameter without corresponding conversion. This is because in java, "English characters" may be considered as escape characters, causing unexpected problems during character processing, so I think it is more reasonable to use the directory directly as a parameter. .
2. This document uses connections instead of buttons when submitting some forms. This is because when JavaScript processes strings with "", it may also process escape characters. Therefore, in order to prevent this situation, so Submissions that pass directory parameters use the connection form.
3. strStat and strErr are two strings that run throughout the file. The former is a judgment command for what operations the page will perform, and the latter is an information prompt for errors in all operations.
4. I will not make any explanation for any safety or other disputes that may arise from this document. I just provide this file as a free tool for everyone's reference and use.
-------------------------------------------------- ---------------
File content admin.jsp
<%-- oddWorld website file management system (Simplified Chinese version) October 10, 2003
copy right by joard Ast
admin.jsp function: website file background management page.
--%>
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.Date" %>
<%@ page import="com.jspsmart.upload.SmartUpload" %>
<%@ page import="javax.servlet.http.HttpSession" %>
<%@ page import="javax.servlet.http.HttpServletRequest" %>
<%@ page import="java.lang.reflect.*" %>
<% //Chinese character conversion%>
<%!
public static String UnicodeToChinese(String s){
try{
if(s==null||s.equals("")) return "";
String newstring=null;
newstring=new String(s.getBytes("ISO8859_1"),"gb2312");
return newstring;
}
catch(UnsupportedEncodingException e)
{
return s;
}
}
public static String ChineseToUnicode(String s){
try{
if(s==null||s.equals("")) return "";
String newstring=null;
newstring=new String(s.getBytes("gb2312"),"ISO8859_1");
return newstring;
}
catch(UnsupportedEncodingException e)
{
return s;
}
}
%>
<%
//refresh problem
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
//Customize password and username for login
//Correct username
String username="admin"
//Correct password
String userpass="oddworld";
//Get the system path
ServletContext app=(ServletContext)pageContext.getServletContext();
String strSysPath = app.getRealPath("/");
//Process the physical path of the object
String strDealPath="";
//Display error message
String strErr="";
//Represents the display status of the page, login is to display the login page; show is to display file information normally; edit is to display the page of editing files; editDo is the writing operation of editing files
; createF is to display the page of creating folders; createFDo is The operation of creating a folder; renameFold is the page that displays the name of
the
folder; renameFoldDo is the operation of changing the name of the folder; delFoldDo is the operation of deleting the folder; renameFile is the page that displays the name of the file; renameFileDo is the operation of changing the name of the file;
delFileDo is the operation of deleting files; uploadFile is the page that displays uploaded files; uploadFileDo is the operation of uploading files;
String strStat="login";
//Array used to display files in show state
File[] fileArr=null;
//Get the physical path of the object to be processed based on the passed path parameter
if (request.getParameter("path")==null || request.getParameter("path").equals("")){
strDealPath=strSysPath;
}else{
//Get path parameters
strDealPath=UnicodeToChinese(request.getParameter("path"));
}
//Check whether the session value exists, if not, display an error message
//HttpSession session = request.getSession(false);
if (session.getValue("loginIn")==null || !session.getValue("loginIn").equals("pass"))
{
strStat="login";
strErr="You have not logged in or your login has timed out, please log in again!";
}
//Create a file object and check whether the directory exists
File myFile=new File(strDealPath);
//Check whether the folder exists
if(!myFile.exists()){
strErr="The folder you selected does not exist, please select again!";
}
//According to different parameters, perform corresponding operations
if(request.getParameter("act")==null || request.getParameter("act").equals("") ||
request.getParameter("act").equals("login"))
{
if(request.getParameter("username")!=null && request.getParameter("userpass")!=null)
{
//Correct MD5 encrypted password
//String userpass="OEEO99107DC8C1EE2E06666B965601EF";
if(request.getParameter("username").equals(username) && (request.getParameter("userpass")).equals(userpass))
{
session.putValue("loginIn","pass");
response.sendRedirect(request.getRequestURI()+"?act=show");
}
}
else {
strStat="login";
strErr="You have not logged in or your login has timed out, please log in again!";
}
}else if(request.getParameter("act").equals("show")){
//Default, the page displays file information normally statStat="show"
strStat="show";
//Create file list array
fileArr=myFile.listFiles();
}else if(request.getParameter("act").equals("edit"))
{
//Page for editing file content
//According to whether there is request.getParameter("file") and whether the corresponding file exists. If so, perform the editing operation. If not, display an error message.
if (!(request.getParameter("file")==null || request.getParameter("file").equals(""))){
File fileEdit=new
File(UnicodeToChinese(request.getParameter("path"))+UnicodeToChinese(request.getParameter("file")));
if(fileEdit.exists())
//The file editing operation is actually to change the display of the page, and use a textarea to display the file information for editing.
strStat="edit";
else
//Display error message
strErr="The file you selected does not exist, please select again!";
}else{
strErr="You have not selected the file to edit, please select again!";
}
}else if(request.getParameter("act").equals("editDo"))
{
//Write the modified content to the file and return to the modification page
if (!(request.getParameter("file")==null || request.getParameter("file").equals("")))
{
File fileEdit=new
File(UnicodeToChinese(request.getParameter("path"))+UnicodeToChinese(request.getParameter("file")));
if(fileEdit.exists())
{
//File editing operation is actually to use a textarea to display the content of the file on the page after modifying the file content, and continue editing or
viewing the effect of the modification.
if(!(request.getParameter("fileData")==null))
{
try{
PrintWriter pwEdit =null;
pwEdit=new PrintWriter(new
FileOutputStream(UnicodeToChinese(request.getParameter("path"))+UnicodeToChinese(request.getParameter("file"))));
pwEdit.println(UnicodeToChinese(request.getParameter("fileData")));
pwEdit.close();
response.sendRedirect(request.getRequestURI()+"?path="+
UnicodeToChinese(request.getParameter("path")) +"&file="+ UnicodeToChinese(request.getParameter("file")) +"&act=edit" );
return;
}catch(Exception e){
strErr="File writing error, please select again!";
}
}else{
strErr="The parameter to modify the file content is missing, please select again!";
}
}else
//Display error message
strErr="The file you selected does not exist, please select again!";
}else{
strErr="You have not selected the file to edit, please select again!";
}
}else if(request.getParameter("act").equals("createF"))
{
//Display the page to create a new folder
strStat="createF";
}else if(request.getParameter("act").equals("createFDo"))
{
//Create new folder
String strFoldName=strDealPath+UnicodeToChinese(request.getParameter("foldName")).trim()+"\";
//out.println(strFoldName);
//out.close();
File fileCreateF=new File(strFoldName);
if(!fileCreateF.exists())
{
try{
fileCreateF.mkdir();
response.sendRedirect(request.getRequestURI()+"?path="+strDealPath+"&act=show");
return;
}catch(Exception e){
strErr="Failed to create new folder!";
}
}
else
{
strErr="The specified folder name is the same as the existing folder name, please specify a new folder name!";
}
}else if(request.getParameter("act").equals("delFoldDo"))
{
//Delete operation
try{
String strFileDelF=strDealPath+UnicodeToChinese(request.getParameter("fold"))+"\";
File fileDelF=new File(strFileDelF);
if(fileDelF.exists()){
File[] fileArrCheck=fileDelF.listFiles();
if(!(fileArrCheck.length>0))
{
fileDelF.delete();
response.sendRedirect(request.getRequestURI()+"?path="+strDealPath+"&act=show");
return;
}else
{
strErr="The folder still contains files, please delete all files and then delete the folder";
}
}else{
strErr="The folder to be deleted does not exist, please select again";
}
}catch(Exception e)
{
strErr="Folder deletion operation error!";
}
}else if(request.getParameter("act").equals("renameFold"))
{
strStat="renameFold";
}else if(request.getParameter("act").equals("renameFoldDo"))
{
//Folder rename operation
//Determine whether there is a change to the folder name based on the parameters
if(request.getParameter("changeDo").equals("true"))
{
//There is a file name, and the name change occurs
try{
String strFileRenameF=strDealPath+UnicodeToChinese(request.getParameter("fold"))+"\";
File fileRenameF=new File(strFileRenameF);
String strFileRenameToF=strDealPath+UnicodeToChinese(request.getParameter("newFoldName"))+"\";
File fileRenameToF=new File(strFileRenameToF);
//Determine whether the renamed folder exists
if(fileRenameF.exists()){
//Determine whether the new folder name has the same name as the existing folder
if(!fileRenameToF.exists())
{
fileRenameF.renameTo(fileRenameToF);
response.sendRedirect(request.getRequestURI()+"?path="+strDealPath+"&act=show");
return;
}else
{
strErr="The specified folder name is the same as the existing folder name, please specify a new folder name!";
}
}else{
strErr="The folder to be renamed does not exist, please select again";
}
}catch(Exception e)
{
strErr="Folder rename operation error!";
}
}
}else if(request.getParameter("act").equals("renameFile"))
{
strStat="renameFile";
}else if(request.getParameter("act").equals("renameFileDo"))
{
//File rename operation
//Determine whether there is a change to the file name based on the parameters
if(request.getParameter("changeDo").equals("true"))
{
//There is a file name, and the name change occurs
try{
String strFileRenameFi=strDealPath+UnicodeToChinese(request.getParameter("file"));
File fileRenameFi=new File(strFileRenameFi);
String strFileRenameToFi=strDealPath+UnicodeToChinese(request.getParameter("newFileName"));
File fileRenameToFi=new File(strFileRenameToFi);
//Determine whether the renamed file exists
if(fileRenameFi.exists()){
//Determine whether the new file name has the same name as the existing file
if(!fileRenameToFi.exists())
{
fileRenameFi.renameTo(fileRenameToFi);
response.sendRedirect(request.getRequestURI()+"?path="+strDealPath+"&act=show");
return;
}else
{
strErr="The specified file name is the same as the existing file name, please specify a new file name!";
}
}else{
strErr="The file to be renamed does not exist, please select again";
}
}catch(Exception e)
{
strErr="File rename operation error!";
}
}
}else if(request.getParameter("act").equals("delFileDo"))
{
//Delete operation
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="The file to be deleted does not exist, please select again";
}
}catch(Exception e)
{
strErr="File deletion operation error!";
}
}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" />
<%
//Upload file operation
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="File upload error, please check whether the file size limit of 1M is exceeded!";
}
}
%>
<%
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> Website File Manager</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>Physical path:</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>Login</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">Login name: </font></b></td>
<td>
<input maxlength=16
name="username" value="">
</td>
</tr>
<tr>
<td width="100"><b><font size="-1">Password:</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="Login">
</td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<br>
</td>
</tr>
</table>
</td>
</tr>
</table>
<% //Error message display
}else if(strErr!=""){
%>
<table width="90%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><font size=+2><strong>Operation error</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">Error reason: </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);">Return operation</a> ]</TT> <tt >[
<a href="<%=request.getRequestURI()%>
?path=<%=UnicodeToChinese(request.getParameter("path"))%>&act=show">Return to directory</a>
]<input type=hidden name="changeDo" value="false"></tt> </td>
</tr>
</tbody>
</form>
</table>
<%
}else if(strStat.equals("show")){
//Display the page normally
%>
<table width="90%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><font size=+2><strong>Directory list:</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">Name</font></strong></font><TT> (click to enter the corresponding directory)</font> TT></td>
<td align=center><font size=+1><strong><font size="-1">Modification time</font></strong></font></td>
<td align=center><b><font size="-1">Rename</font></b></td>
<td align=center><b><font size="-1">Delete</font></b></td>
</tr>
<%
//Display the initial color of the table rows
String bgColor="";
//If it is not the root directory, display a link back to the upper directory
if(!(strDealPath.equals(strSysPath))){%>
<tr bgcolor=<%=bgColor%>>
<td align=left > <tt><font color=#000066 face=WingDings
size=4>0</font>
<a title="Click to enter the upper directory" href="<%=request.getRequestURI()%>
?path=<%=(myFile.getParent())+" \"%>&act=show
">Upper directory</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 it is a folder, display it
if(fileArr[i].isDirectory()){
//Color interlaced conversion
bgColor=bgColor.equals("#eeeeee") ? "" : "#eeeeee";
%>
<tr bgcolor=<%=bgColor%>>
<td align=left > <tt><FONT color=#000066 face=WingDings
size=4>0</FONT>
<a title="Click to enter the corresponding directory" 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">Rename</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('Do you really want to delete this folder, all the contents will no longer be available?
')){ window.dataFormFold<%=i%>.submit();}">Delete</a></TT></td></form>
</tr>
<%}
} %>
<tr align="center">
<td bgcolor=#cccccc colspan=4><TT>[ <a href="<%=request.getRequestURI()%>?path=<%=strDealPath%>&act=createF">New folder
</a>
]</TT></td>
</tr>
</tbody>
</table>
<table width="90%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><font size=+2><strong>File list:</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">Name</font></STRONG></FONT><TT> (Click to edit the corresponding file)</ TT></TD>
<TD align=center><FONT size=+1><strong><font size="-1">size</font></strong></FONT></TD>
<TD align=center><FONT size=+1><STRONG><font size="-1">Modification time</font></STRONG></FONT></TD>
<TD align=center><b><font size="-1">Rename</font></b></TD>
<TD align=center><b><font size="-1">Delete</font></b></TD>
</TR>
<%
bgColor="#eeeeee";
if(fileArr.length!=0){
for(int i=0; i<fileArr.length; i++){
//If it is a file, display it
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="Click to edit the corresponding file" 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">Rename</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('Do you really want to delete this file? The content will no longer be available?
')){window.dataFormFile <%=i%>.submit();}">Delete</a></TT></TD></form>
</TR>
<%}
}
}else {%>
<TR>
<TD align=left > <TT>No file</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">Upload
file
</a>]</TT></TD>
</TR>
</TBODY>
</TABLE>
<%
//Normal display state ends
}else if(strStat.equals("edit")){
//File editing status
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>Edit file:</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">File name</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();">Submit content</a> ]</TT> <TT>[ <a
href="<%=request. getRequestURI()%>?path=<%=UnicodeToChinese(request.getParameter("path"))%>&act=show">Return to directory</a> ]</TT>
</td>
</tr>
</tbody>
</form>
</table>
<%
}else if(strStat.equals("createF")){
%>
<table width="90%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><font size=+2><strong>Create folder:</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"))%>&act=createFDo" method="post">
<tbody>
<tr bgcolor=#cccccc>
<td align=left><font size=+1><strong><font size="-1">The folder you want to create is in</font></strong></font><font color=#000066
face=WingDings
size=4>0</font><tt><%=(UnicodeToChinese(request.getParameter("path")))%></tt><font size=+1><strong><font size="- 1">Down
</font></strong></font></td>
</tr>
<tr>
<td align=left>
<TT>New folder name:</TT><input type=text name=foldName value="" maxlength="50" size="50">
</td>
</tr>
<tr>
<td bgcolor=#cccccc align="center"> <tt>[ <a href="javascript:if (checkForm()==false);">Submit content</a>
]</tt> <tt>[
<a href="<%=request.getRequestURI()%>
?path=<%=UnicodeToChinese(request.getParameter("path"))%>&act=show">Return to table of contents</a>
]</tt> </td>
</tr>
</tbody>
</form>
</table>
<%
}else if(strStat.equals("renameFold"))
{ %>
<table width="90%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><font size=+2><strong>Rename folder:</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><font size=+1><strong><font size="-1">The folder you want to rename</font></strong></font><font color=#000066
face=WingDings
size=4>0</font><tt><%=(UnicodeToChinese(request.getParameter("path"))+UnicodeToChinese(request.getParameter("fold"))+" \")% ><
/tt ></td>
</tr>
<tr>
<td align=left> <tt>Renamed folder name:</tt>
<input type=text name=newFoldName value="<%=UnicodeToChinese(request.getParameter("fold"))%>" maxlength="50"
size="50">
</td>
</tr>
<tr>
<td bgcolor=#cccccc align="center"> <tt>[ <a href="javascript:if (checkForm2()==false);">Submit content</a>
]</tt> <tt>[
<a href="<%=request.getRequestURI()%>
?path=<%=UnicodeToChinese(request.getParameter("path"))%>&act=show">Return to table of contents</a>
]<input type=hidden name="changeDo" value="false"></tt> </td>
</tr>
</tbody>
</form>
</table>
<%
}else if(strStat.equals("renameFile"))
{%>
<table width="90%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><font size=+2><strong>Rename file:</strong></font></td>
</tr>
</table>
<table align=center cellpadding=5 cellspacing=0 width="90%">
<form name=dataForm3
action="<%=request.getRequestURI()%>?path=<%=UnicodeToChinese(request.getParameter("path"))%>&file=<%=UnicodeToChinese(reques
t.getParameter(" file"))%>&act=renameFileDo" method="post">
<tbody>
<tr bgcolor=#cccccc>
<td align=left><font size=+1><strong><font size="-1">The file you want to rename</font></strong></font><font color=#000066
face =WingDings
size=4>3</font><tt><%=(UnicodeToChinese(request.getParameter("path"))+UnicodeToChinese(request.getParameter("file")))%></tt><
/td>
</tr>
<tr>
<td align=left> <tt>Renamed file name:</tt>
<input type=text name=newFileName value="<%=UnicodeToChinese(request.getParameter("file"))%>" maxlength="50"
size="50">
</td>
</tr>
<tr>
<td bgcolor=#cccccc align="center"> <tt>[ <a href="javascript:if (checkForm3()==false);">Submit content</a>
]</tt> <tt>[
<a href="<%=request.getRequestURI()%>
?path=<%=UnicodeToChinese(request.getParameter("path"))%>&act=show">Return to table of contents</a>
]
<input type=hidden name="changeDo" value="false">
</tt> </td>
</tr>
</tbody>
</form>
</table>
<%
}else if(strStat.equals("uploadFile")){
%>
<table width="90%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><font size=+2><strong>Upload files:</strong></font></td>
</tr>
</table>
<table align=center cellpadding=5 cellspacing=0 width="90%">
<form name=dataForm4
action="<%=request.getRequestURI()%>?path=<%=UnicodeToChinese(request.getParameter("path"))%>&act=uploadFileDo" method="post"
ENCTYPE="multipart /form-data">
<tbody>
<tr bgcolor=#cccccc>
<td align=left><font size=+1><strong><font size="-1">The file you want to upload is at</font></strong></font><font color=#000066
face =WingDings
size=4>0</font><tt><%=(UnicodeToChinese(request.getParameter("path")))%></tt><font size=+1><strong><font size="- 1">Down
</font></strong></font></td>
</tr>
<tr>
<td align=left> <tt>Select the uploaded file:</tt>
<INPUT TYPE="FILE" NAME="fileName" SIZE="30"></td>
</tr>
<tr>
<td bgcolor=#cccccc align="center"> <tt>[ <a href="javascript:if (checkForm4()==false);">Submit content</a>
]</tt> <tt>[
<a href="<%=request.getRequestURI()%>
?path=<%=UnicodeToChinese(request.getParameter("path"))%>&act=show">Return to table of contents</a>
]
</tt> </td>
</tr>
</tbody>
</form>
</table>
<%
}
%>
<br>
<br>
<hr>
<TT>©Copyright: Jarard·Ast Version: Simplified Chinese 1.00</TT>
<br><TT>For any comments or suggestions, please contact: <a href=" mailto:[email protected]"><font color=red>[email protected]</font></a></TT>
</div>
</BODY></HTML>
<SCRIPT LANGUAGE=javascript>
<!--
<%
//Function that displays different detection parameters based on different parameters
if(strStat.equals("login")) {%>
function checkform()
{
var Checkblank = /^(s*|( )|(.))*$/;
if (Checkblank.test(dataform.username.value))
{
alert("Login name cannot be empty!");
return false;
}
if (Checkblank.test(dataform.userpass.value))
{
alert("Password cannot be empty!");
return false;
}
window.dataform.submit();
}
<%}else if(strStat.equals("createFold")) {%>
function checkForm()
{
var Checkblank = /^(s*|( )|(.))*$/;
if (Checkblank.test(dataForm.foldName.value))
{
alert("The name of the new folder cannot be empty!");
dataForm.foldName.focus();
return false;
}
var SPECIAL_STR = " \/:*? "><|";
for(i=0;i<(dataForm.foldName.value).length;i++)
{
if (SPECIAL_STR.indexOf((dataForm.foldName.value).charAt(i)) !=-1)
{
alert("The folder name cannot contain the following characters \/:*? "><|");
dataForm.foldName.focus();
return false;
}
}
window.dataForm.submit();
}
<%}else if(strStat.equals("renameFold")) {%>
function checkForm2()
{
var Checkblank = /^(s*|( )|(.))*$/;
if (Checkblank.test(dataForm2.newFoldName.value))
{
alert("The renamed folder name cannot be empty!");
dataForm2.newFoldName.focus();
return false;
}
var SPECIAL_STR = " \/:*? "><|";
for(i=0;i<(dataForm2.newFoldName.value).length;i++)
{
if (SPECIAL_STR.indexOf((dataForm2.newFoldName.value).charAt(i)) !=-1)
{
alert("The folder name cannot contain the following characters \/:*? "><|");
dataForm2.newFoldName.focus();
return false;
}
}
//If the file name is different from the original file name after renaming, mark a parameter to indicate that the rename action has indeed occurred.
if(dataForm2.newFoldName.value!="<%=UnicodeToChinese(request.getParameter("fold"))%>")
{
window.dataForm2.changeDo.value="true";
}
else
{
alert("Please enter a new folder name!");
dataForm2.newFoldName.focus();
return false;
}
window.dataForm2.submit();
}
<%}else if(strStat.equals("renameFile"))
{%>
function checkForm3()
{
var Checkblank = /^(s*|( )|(.))*$/;
if (Checkblank.test(dataForm3.newFileName.value))
{
alert("The renamed folder name cannot be empty!");
dataForm3.newFileName.focus();
return false;
}
var SPECIAL_STR = " \/:*? "><|";
for(i=0;i<(dataForm3.newFileName.value).length;i++)
{
if (SPECIAL_STR.indexOf((dataForm3.newFileName.value).charAt(i)) !=-1)
{
alert("The file name cannot contain the following characters \/:*? "><|");
dataForm3.newFileName.focus();
return false;
}
}
//If the file name is different from the original file name after renaming, mark a parameter to indicate that the rename action has indeed occurred.
if(dataForm3.newFileName.value!="<%=UnicodeToChinese(request.getParameter("file"))%>")
{
window.dataForm3.changeDo.value="true";
}
else
{
alert("Please enter a new file name!");
dataForm3.newFileName.focus();
return false;
}
window.dataForm3.submit();
}
<%}else if(strStat.equals("uploadFile")){%>
function checkForm4()
{
var Checkblank = /^(s*|( )|(.))*$/;
if (Checkblank.test(dataForm4.fileName.value))
{
alert("The renamed folder name cannot be empty!");
dataForm4.fileName.focus();
return false;
}
window.dataForm4.submit();
}
<%}%>
//-->
</SCRIPT>