• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Anyone know how to save the response (html) of a jsp page to a file

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Author
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic