java ftp获取服务器目录文件并显示
<%@ page contenttype="text/html; charset=gb2312" language="java" import="java.sql.*" errorpage="" %>
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.111cn.net/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>java ftp获取服务器目录文件并显示</title>
</head>
<body>
<%
package com.xuz.csdn.worldcup.day8;import java.io.bufferedreader;
import java.io.fileinputstream;
import java.io.filenotfoundexception;
import java.io.ioexception;
import java.io.inputstream;
import java.io.inputstreamreader;public class filereader {
public static void main(string[] args) {
inputstream is = null;
bufferedreader response = null;
try {
is = new fileinputstream("d:/1.txt");
response = new bufferedreader(new inputstreamreader(is));
string echo ;
while ((echo = response.readline()) != null) {
system.out.println(echo);
}
} catch (filenotfoundexception e) {
e.printstacktrace();
} catch (ioexception e) {
e.printstacktrace();
} finally {
try {
response.close();
is.close();
} catch (ioexception e) {
e.printstacktrace();
}
}
}}
%>
</body>
</html>