A� vai um Exemplo:

 

import java.awt.*;

import java.applet.*;

import java.util.*;

import java.io.*;

import java.net.URL;

import java.net.MalformedURLException;

 

public class Teste extends Applet  {

    String  fileName = "teste.txt";

 

    //************************************************************************

    // initialization time!

    //************************************************************************

    public void init() {

            this.leArquivo();

    }

 

    synchronized void leArquivo() {

        InputStream         conn;

        DataInputStream     dis = null;

        URL     theURL = null;

 

        if (fileName==null) return;

        try {

            if (fileName.indexOf("http://") >= 0 ) {

                theURL = new URL(fileName);

            }

            else {

                theURL = new URL(this.getDocumentBase(),fileName);

            }

            try {

                String  line;

 

                conn = theURL.openStream();

                dis = new DataInputStream(new BufferedInputStream(conn));

                while( (line=dis.readLine())!=null) {

                                   this.add(new Label(line));

                }

            }

            catch (IOException e) {}

 

        }

        catch (MalformedURLException e) {}

    }

}

 

[]s,

 

Sergio Stateri Jr

[EMAIL PROTECTED]

 

-----Mensagem original-----
De: Fl�vio Fagundes [mailto:[EMAIL PROTECTED]]
Enviada em: quarta-feira, 18 de julho de 2001 14:31
Para: Lista Java
Assunto: [java-list] Applet obtendo arquivos do Servidor

 

Pessoal estou com um problema,
algu�m tem uma dica de como fazer para que meu applet leia arquivos TXT ou htmls do servidor?
Sempre d� problema com a permiss�o de conex�o!

[ ] ,s

--
==============================================
 Fl�vio Fagundes
 ICQ=76671182  [Phantom]
 Home Page: http://pucrs.campus2.br/~flavio
----------------------------------------------
 PUCRS - CAMPUS II
 URUGUAIANA - RS
==============================================
 

Responder a