Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

print writer

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello there,
I am trying to use below code to use print writer ,
import java.io.*;
import java.net.*;
import java.awt.event.*;
import java.awt.*;
import java.applet.*;

public class OutPut extends Applet
{

public void init()
{
try{

URL url = new URL("http://server1/vippast/hello.txt";);
URLConnection urlcon = url.openConnection();
urlcon.setDoOutput(true);
ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
PrintWriter pt = new PrintWriter(baos,true);
String str = "this is output applet " ;
pt.println(str);
pt.flush();
pt.close();
baos.close();

System.out.println("printwriter printed to " + url + ";" + str);
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}
do I have to save "hello.txt" file on server1 or this program creates it , where does "printwriter.print(string) " statement produces result , in "hello.txt" ?
thanks


[This message has been edited by ray bond (edited November 17, 2000).]
 
I love a woman who dresses in stainless steel ... and carries tiny ads:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic