Directory.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <%@page import="java.io.*" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'Directory.jsp' starting page</title> </head> <body> <% path=request.getRealPath("")+"\\test"; File d=new File(path); if(d.exists()){ d.delete(); out.print("test文件夹已经被删除!!!"); } else{ d.mkdir(); out.print("test文件夹已经被创建!!!"); } %> </body> </html>