<%@ page import="java.io.*" %>
<%
String str = "print me";
//always give the path from root. This way it almost always works.
String nameOfTextFile = "e:\\jsp\\write.txt";
try {
PrintWriter pw = new PrintWriter(new FileOutputStream(nameOfTextFile));
pw.println(str);
//clean up
pw.close();
} catch(IOException e) {
out.println(e.getMessage());
}
%>
源码如上,文件运行完毕之后,打开e:\\jsp\\write.txt,可以看到print me已经被写在了文件当中。该例程测试通过,如有问题,可联系我。
正文
JSP中不使用javabean写文件的例子2006-03-24 10:27:00
【评论】 【打印】 【字体:大 中 小】 本文链接:http://blog.pfan.cn/itzhiren/11338.html
阅读(4763) | 评论(0)
版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!
评论