<%@ page import=
<html>
<head>
<title>Lion互動網絡==》JSP中讀文件和寫文件的例子</title>
</head>
<body>
<%
//寫文件
String str =
String filename = request
java
if(!f
{
f
}
try
{
PrintWriter pw = new PrintWriter(new FileOutputStream(filename));
pw
pw
}
catch(IOException e)
{
out
}
//讀文件
java
char[] buffer = new char[
int length; //讀出的字符數(一個中文為一個字符)
//讀文件內容
out
while((length=fr
{
//輸出
out
}
fr
%>
</body>
</html>
From:http://tw.wingwit.com/Article/program/Java/hx/201311/25761.html