Thanks matey!

Think you have given me most of what I need to complete the dodgy
description I gave of my problem =)

Cheers

bren

-----Original Message-----
From: Jeevan P.V.S.S [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 8 August 2002 6:08 PM
To: [EMAIL PROTECTED]
Subject: Re: generating flat html files

Hai Brendan !

  You access the servlets with browser and can save the page. If you
need a java program to do it,
      I'm sending a program, you read it and do the changes accordingly.
  - Jeevan

import java.net.*;
import java.io.*;

public class URLLoader {
    public static void main(String args[]) {
        if(args.length!=1) {
            System.out.println("Usage: java URLLoader <url>");
            System.exit(0);
        }

        try {
            URL url = new URL(args[0]);
            BufferedReader reader = new BufferedReader(new
InputStreamReader(url.openStream()));
            FileWriter writer = new FileWriter("URL.html");
            String str="";
            while((str=reader.readLine())!=null) {
                System.out.println(str);
                writer.write(str,0,str.length());
            }
            writer.close();
        }catch(Exception ex) {
            ex.printStackTrace();
        }
    }
}


Brendan Spinks wrote:

>Hi there
>
>This might be obvious, and to be honest whenever thinking about it before I
>thought it would be simple... how can I get my dynamic pages to generate
>flat html files (unique versions so each time they are 'processed' it might
>be file1.html, next file2.html etc.)?
>
>I use the/an MVC approach, controlling servlets accessing the model via
>model wrappers, then displaying the content via jsp. The environment is
>Tomcat, j2sdk1.4.1 and I have been looking into different ways to
accomplish
>this ( searching google =) ). Is there a way I can add the html stream to a
>buffer after the generated servlet sends the html response to the browser?
>Then I could write this to a file? Any pointers most appreciated.
>
>Thanks in advance
>
>bren
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
> http://archives.java.sun.com/jsp-interest.html
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.jsp
> http://www.jguru.com/faq/index.jsp
> http://www.jspinsider.com
>
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to