Article View: borland.public.jbuilder.java.language
Article #19228Can applet write and read server files ?
From: Arnaldo Salaroli Rugai
Date: Thu, 26 Feb 1998 00:00
Date: Thu, 26 Feb 1998 00:00
71 lines
2336 bytes
2336 bytes
I wrote the applet below to read and write files locally (just a counter)
that runs in Jbuilder. How to change for read and write files on the server
side directory ?
//Title: Contador
//Version: 1.0
//Copyright: Copyright (c) 1997
//Author: Arnado Salaroli Rugai
//Company: Fauna Informatica
//Description: should be a counter for Web Pages
package contador;
import java.applet.*;
import java.io.*;
public class contador extends Applet {
boolean isStandalone = false;
static String versao = "1.0";
int i = 0;
String pagweb, a;
FileInputStream arqent;
DataInputStream linhaEntrada;
FileOutputStream arqsai;
DataOutputStream linhaSaida;
public contador() {
}
public void init() {
pagweb = getParameter("Pagina");
if (pagweb.equals("")) {
pagweb = "counter.out";
}
try {
arqent = new FileInputStream(pagweb);
linhaEntrada = new DataInputStream(arqent);
try {
i = linhaEntrada.read();
linhaEntrada.close();
arqent.close();
}
catch (java.io.IOException e) {
System.err.println(getclassInfo() + " Erro Leitura: " + e);
}
}
catch (java.io.IOException e) {
// Se n�o existe cria em start()
}
}
//Start the applet
public void start() {
i = i + 1;
try {
arqsai = new FileOutputStream(pagweb);
linhaSaida = new DataOutputStream(arqsai);
linhaSaida.write(i);
linhaSaida.close();
arqsai.close();
}
catch (java.io.IOException e) {
System.err.println(getclassInfo() + " Erro Grava�ao: " + e);
System.exit(1);
}
}
}
Thanks,
Arnaldo Salaroli Rugai - Please also reply to : fauna@inbrapenet.com.br
Technical Details
Message-ID:
<01bd4228$9d5d3ba0$2b07fac8@sircx.inbrapenet.com.br>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f74b3,290c9cd7283c32e5,start X-Google-Attributes: gidf74b3,public From: "Arnaldo Salaroli Rugai" <fauna@inbrapenet.com.br> Subject: Can applet write and read server files ? Date: 1998/02/26 Message-ID: <01bd4228$9d5d3ba0$2b07fac8@sircx.inbrapenet.com.br> X-Deja-AN: 328856192 Content-Transfer-Encoding: 8bit Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Organization: Fauna Informática Newsgroups: borland.public.jbuilder.java.language