【JSP开源代码栏目提醒】:网学会员为广大网友收集整理了,ex9_02.jsp,希望对大家有所帮助!
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<%--建立文件--%>
<%@ page import="java.io.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>JSP通用范例大全</title>
</head>
<body>
<center><font size=5>建立文件</font></center>
<br><hr><br>
<%
String path=request.getRealPath("/");
File fileName=new File(path,"filetest.txt");
if(fileName.exists())
out.println("文件"+path+"filetest.txt"+"已存在");
else{
fileName.createNewFile();
out.println("文件"+path+"filetest.txt"+"不存在,已完成建立");
}
%>
</body>
</html>
上一篇:
ex9_01.jsp
下一篇:
秋天是疼痛的