New at Java

Sharky Forums


Results 1 to 3 of 3

Thread: New at Java

  1. #1
    Expensive Sushi
    Join Date
    May 2001
    Location
    Surrey, BC, Canada
    Posts
    35

    New at Java

    Is there a way that I can get this to show up on a web page? The File that is writen

    import java.io.*;

    public class Copy {
    public static void main(String[] args) throws IOException {
    File inputFile = new File("any.txt");
    File outputFile = new File("new.txt");

    FileReader in = new FileReader(inputFile);
    FileWriter out = new FileWriter(outputFile);
    int c;

    while ((c = in.read()) != -1)
    out.write(c);

    in.close();
    out.close();
    }
    }
    You need a any.txt
    Thanks if you have any ideas that would be cool

  2. #2
    Tiger Shark
    Join Date
    Feb 2001
    Location
    Satan Country
    Posts
    564

    Re: New at Java

    Originally posted by Triple__J
    Is there a way that I can get this to show up on a web page? The File that is writen

    import java.io.*;

    public class Copy {
    public static void main(String[] args) throws IOException {
    File inputFile = new File("any.txt");
    File outputFile = new File("new.txt");

    FileReader in = new FileReader(inputFile);
    FileWriter out = new FileWriter(outputFile);
    int c;

    while ((c = in.read()) != -1)
    out.write(c);

    in.close();
    out.close();
    }
    }
    You need a any.txt
    Thanks if you have any ideas that would be cool
    The code itelf is pretty simple, but you will have to do some setup. You need to set up a web server and a servlet engine. From there, you can create a jsp and do very similar code to show the page.

    Do a search on the resin servlet engine/server and they should have some examples of the basic syntax and procedure.
    I'm half Scottish and half French.

    I surrender to alcohol.

  3. #3
    Reef Shark mefisto3's Avatar
    Join Date
    Jul 2001
    Location
    Melbourne, Vic, Australia
    Posts
    429
    or you can use tomcat servlet engine/web server. it is pretty easy to set up. you can find it in www.apache.org under jakarta tomcat.

    also, what IDE are u using (if any). i know that JBuilder has integrated tomcat, so it would be extremely easy to create servlets without any set up at all.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •