⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usingfile.jsp

📁 jsp动态网站开发与实例(第3版) 源码
💻 JSP
字号:
	<%@page contentType="text/html"%>
	<%@page pageEncoding="Ms950"%>
	<%@page import="java.io.*"%>
	<html>
	    <head><title>运用File对象</title></head>
	    <body>
	 
	    <%
	        String thePath=request.getRealPath("/")+"ch11\\theFile" ; 
	        File myDir = new File(thePath)   ;
	        File myFile = new File(thePath,"testFile.txt" )   ;
	        File mynotExistFileFile = new
	 			 File(thePath,"notExistFile.txt" )   ;
	        out.println(
	                "目录 "+thePath+ " 是否存在:" + 
	                myDir.exists() + "<BR>"  );
	        out.println(
	                "文件 "+thePath+ "\\testFile.txt 是否存在:" + 
	                myFile.exists() + "<BR>" );
	        out.println("文件 "+thePath+ "\\notExistFile.txt 是否存在:" +
	        mynotExistFileFile.exists() + "<BR>"+ "<BR>" );
	
	        out.println("文件 "+thePath+ "\\testFile.txt 是否可读取:" + 
	        myFile.canRead() + "<BR>" );
	        out.println("文件 "+thePath+ "\\testFile.txt 是否可写入:" + 
	        myFile.canWrite() + "<BR>" );
	    %>
	
	    </body>
	</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -