Anyone know how to save the response (html) of a jsp page to a file
Joined: Mar 05, 2003
Does anyone know how to save/redirect the response html of a jsp page to a file ( i.e. with extension .html, .txt etc )? I want to save the html code that is sent to the browser on a server thus making it permanent.
Joined: Jan 29, 2003
Can you replace the output writer on Response with your own that writes everything to the original writer AND to disk at the same time? This can't be good for performance. How do you plan to use the disk copy? I can conceive a strategy where you dynamically generate a page once, then use the disk copy after that, but there would be a good number of challenges!
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: May 24, 2001
i think you are generating a static site automatically so that dynamic updates are quick and automated - is that right? try to get a hold of a spider or web crawler that will do this for you (not done this myself so cant help any further.) i know some people have done this before - basically there are number of ways. You could use software like Cactus (http://jakarta.apache.org/cactus/) to generate your own code that will spider the site or perhaps that can go through it having been given a list of links and save the each page for you with an appropriate filename.
chanoch<p><a href="http://www.amazon.com/exec/obidos/ASIN/1861007736/" target="_blank" rel="nofollow">Author of Professional Apache Tomcat</a></p>
Joined: Sep 07, 2001
use filters available in servlets package to trap the output and then store them in the html files or anywhere you might want to use. that the easier way i think .. or else you can write your own writer and then i think you need to map your writer to the runtime environment which is more complicated as usually the PageContext class will instanciate your jspwriter and maps it to the default jspfactory and makes it available to your jsp page and then replace your own writer with the one present in the jsp i.e implicitly you get the out object in jsp and you need to replace it with your own writer and then i hope you can use the writer to get the desired output. I have tried out both the ways but i feel that the filters are the better and easier way to do the task. If i am wrong plz do inform me. Thanks in advance