• Post Reply Bookmark Topic Watch Topic
  • New Topic

capture JSP output as a static html file

 
Marty Strzembicki
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I currently have a servlet displaying a page with dynamic information retrieved from the database. And of course I have out.println() all over the place..in addition I also have a second PrintWriter declared in my servlet which writes a duplicate information (same as the information displayed by my servlet) into a FileOutputStream in order to achieve writing to a file (static html page, which contains all of the information displayed by the servlet)...

My question is: if I decide to modify my code and use JSP instead of a servlet to display my information..(in order to avoid the tidious out.println() and yes I have to use JSP and avoid using the servlet) is there a way to capture the information displayed by my JSP and write it to a file after the JSP generates the html and displays it in the browser?

I have searched the internet and read some incomplete solutions using Filters and HttpURLConnection, i'm not too familiar with either one of them, I have tried using it and did not succeed. Is there an easier solution... I do have my new JSP working and it is displaying the same information that was previously displayed by the servlet...but How can I retrieve the html generated by the JSP and save it as an external html or plain text file...(it's used for confirmation purposes)?

Maybe anyone has a neat JavaScript solution to this problem? any help would be greatly appreciated

[ December 06, 2004: Message edited by: Marty Str ]
[ December 06, 2004: Message edited by: Marty Str ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35709
408
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marty,
JavaScript isn't going to be able to handle this.

My suggestion is to store the data in the user's server-side session. The user can click on a link (like a printable page link) to get the file.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65522
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Marty Str",

We're pleased to have you here with us in the JSP forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Marty Strzembicki
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you got it
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!