<html>
<head>
<title>ÎļþÉÏÔØ</title>
</head>
<body>
<form action="upjsp.jsp" enctype="MULTIPART/FORM-DATA" method=post>
<br />
¹«Ë¾: <input type="text" name="company" />
<br />
Ñ¡ÔñÒªÉÏÔصÄÎļþ <input type="file" name="filename" />
<br />
<input type="submit" value="ÉÏÔØ" />
</form>
</body>
</html>
================================END=======================================
<jsp:useBean id="TheBean" scope="page" class="UpBean " />
<%
TheBean.doUpload(request);
%>
================================END=======================================
import java.io.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletInputStream;
public class UpBean {
public void doUpload(HttpServletRequest request) throws
IOException {
PrintWriter pw = new PrintWriter(
new BufferedWriter(new FileWriter("test.txt")));
ServletInputStream in = request.getInputStream();
int i = in.read();
while (i != -1) {
pw.print((char) i);
i = in.read();
}
pw.close();
}
}
================================END=======================================