• 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

capture JSP output as a static html file

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you got it
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic