<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="java.io.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'createD.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<%
String pathStr = request.getRealPath("/upload");
pathStr = pathStr + "\\Sub";//将要建立的目录路径
out.println(pathStr);
//建立代表Sub目录的File对象,并得到它的一个引用
File d = new File(pathStr);
if (d.exists()) {//检查Sub目录是否存在
d.delete();
out.println("Sub目录存在,已删除");
} else {
d.mkdir();//建立Sub目录
out.println("Sub目录不存在,已建立");
}
%>
</body>
</html>
posted on 2008-09-19 09:49
李建軍 阅读(159)
评论(0) 编辑 收藏 所属分类:
jsp