【www.gdgbn.com--js教程】

java ftp获取服务器目录文件并显示
<%@ page contenttype="text/html; charset=gb2312" language="java" import="java.sql.*" errorpage="" %>




java ftp获取服务器目录文件并显示

<%
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();
            }
        }
    }

}

%>


本文来源:http://www.gdgbn.com/wangyezhizuo/25425/