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

How can I run a C++ program directly from Windows?

How-can-I-run-a-C-program-directly-from-Windows