Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving jsp output to a file

Status
Not open for further replies.

samvonac

Programmer
May 18, 2001
8
US
Does anyone know how to save the output (html) of a jsp page to a file on the server? I want to save the html code that is sent to the browser as a file on the server.

Thanks.
 
buffer it and copy the buffer in a file (server side, for you), also copy the buffer in the PrintWriter (or anything you use to send back the answer to the user)
 
Thanks for the reply.

Do you have an example? I know how to use the printwriter to send content to a file but is there a way to send the buffer (or contents of) to the printwriter?
 
i don't have example right here ... but there are many at java.sun.com or at the java developper journal (sorry i lost the url)
it looks like this :
StringBuffer result = new StringBuffer("whatever");
result.append("whatever");
out.println(result);

 
The only problem is that the plain html content will not be output to file unless you write out everything using out.println(). blah

You may be able to extend your jsp from a custom base class that outputs to a file instead. I have never tried to change where the output stream writes. Good luck and let us know how it goes. I don't think it will be very hard. Wushutwist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top