Re: writing jsp output to a file

2000-11-14 Thread Stefan Woithe

Joe Laffey wrote:
 
 On Mon, 13 Nov 2000, John Ellis wrote:
 
  All you need to do is create a virtual browser:
 
  URL pageYouWant = new URL(completeRequestString);
  InputStream in = pageYouWant.openStream();
  // burn off the header from in, then write the rest to a file...
 
  This will all be done, of course, in a completely seperate JVM than your
  Tomcat JVM.
 
  It sounds like an ineresting application of jsp.
 
 What if you compile your ordinary JSP into a servlet (by executing it
 normallY). Then go to the compiled servlet and replace "out" with a normal
 DataOutputStream or FileWriter.
 
 Remember that your JSPs all get converted to servlets, which encapsulate
 the HTML portions of the JSP page into out.print() statements.
 
 If you had to do this a lot I bet you could hack a copy of Tomcat or
 GNUJSP pretty easily so that it did this be default.

Any idea which parts of Tomcat 3.1final to hack in order to build this? I've a 
similiar problem: in a servlet I include a JSP (via request dispatcher). This jsp 
renders just a part of the whole response page and I want to get just this part stored.

Thank you

Stefan




Re: writing jsp output to a file

2000-11-14 Thread Vinny

try this:


%@ page import="java.io.*" %
%


FileWriter tempFile = new FileWriter("/tmp/gold.txt",false);
String data = "To be or not to be";
PrintWriter toFile = new PrintWriter(tempFile);
toFile.println(data);
toFile.close();


%


this writes "To be or not to be" into /tmp/gold.txt on a unix system

Juan Ramirez wrote:

 I would like to write the output of a jsp file to a static html file
 instead of sending it out to a browser.  I have a pagebuilding system
 that uses the power of jsp to do a lot of things, but I need to write
 the resulting jsp to a file instead of streaming it out.  Has anyone
 done anything like this?
 
 Thanks.
 
 Juan




writing jsp output to a file

2000-11-13 Thread Juan Ramirez

I would like to write the output of a jsp file to a static html file
instead of sending it out to a browser.  I have a pagebuilding system
that uses the power of jsp to do a lot of things, but I need to write
the resulting jsp to a file instead of streaming it out.  Has anyone
done anything like this?

Thanks.

Juan



Re: writing jsp output to a file

2000-11-13 Thread Joe Laffey

On Mon, 13 Nov 2000, John Ellis wrote:

 All you need to do is create a virtual browser:

 URL pageYouWant = new URL(completeRequestString);
 InputStream in = pageYouWant.openStream();
 // burn off the header from in, then write the rest to a file...

 This will all be done, of course, in a completely seperate JVM than your
 Tomcat JVM.

 It sounds like an ineresting application of jsp.

What if you compile your ordinary JSP into a servlet (by executing it
normallY). Then go to the compiled servlet and replace "out" with a normal
DataOutputStream or FileWriter.

Remember that your JSPs all get converted to servlets, which encapsulate
the HTML portions of the JSP page into out.print() statements.

If you had to do this a lot I bet you could hack a copy of Tomcat or
GNUJSP pretty easily so that it did this be default.


Joe Laffey
LAFFEY Computer Imaging
St. Louis, MO
-
With no walls or fences on the Internet, who needs Windows or Gates?
-