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

📄 writetofile.jsp

📁 jsp动态网站开发与实例(第3版) 源码
💻 JSP
字号:
	<%@page contentType="text/html"%>
	<%@page pageEncoding="GB2312"%>
	<%@page import="java.io.*"%>
	<html>
	    <head><title>写入文件</title></head>
	    <body>
	    <%
	        String thePath=request.getRealPath("/")+"ch10\\theFile" ; 
	        File myFile = new File(thePath,"testFile.txt" )   ;
	        myFile.createNewFile() ;
	        FileWriter myFileWriter = new FileWriter(myFile) ;
	        myFileWriter.write
	 		("这是范例 writeToFile.jsp 运行时所写入的文字 !!");
	        
	        myFileWriter.flush() ; 
	        myFileWriter.close() ;
	        out.println("字符串写入文件testFile.txt完成 !!");
	    %>
	    </body>
	</html>

⌨️ 快捷键说明

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