Wednesday, April 1, 2020

Creation of a txt file through JSP

<%@page import="java.io.*"%><%
//File creation
String strPath = "C:\\example.txt";
File strFile = new File(strPath);
boolean fileCreated = strFile.createNewFile();
//File appending
Writer objWriter = new BufferedWriter(new FileWriter(strFile));
objWriter
.write("This is a test");
objWriter
.flush();
objWriter
.close();
%> source: stackoverflow https://stackoverflow.com/questions/5177305/creation-of-a-text-file-in-jsp

No comments:

Post a Comment

Sacred Thought

5 May 2024 Hari Om Verse 50-51, chapter two:  In this chapter two Shree krishna explains a simple way of living. Free from desires and void ...