• Post Reply Bookmark Topic Watch Topic
  • New Topic

Write File

 
Lin tao
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%@ page import="java.io.*" %>
<%
String str = "print me";
String fileName = "d:\\print.txt";
try {
PrintWriter pw = new PrintWriter(new FileOutputStream(fileName));
pw.println(str);
pw.close();
}
catch(Exception e) {
out.println(e);
}
%>
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you telling us how, asking us how, or just dropping a general comment?
Is there a question associated with the above code?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"tyfun",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp.
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please edit your profile and select a new name which meets the requirements.
Thanks.
Dave
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!