• 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

jsp output to a file

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I want to send the output of a jsp file (ie, the html that the jsp page creates) to a file on the server.
Basically, I want to have the html that the user sees when they do view source from the browser, saved to a file on the server.
I know I can use FileOutputStream to create files on the server but I don't know what to pass into the write() method to write the output of the jsp page.
Thanks in advance.
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("your.log")));
pw.println("print something here");
pw.print("\n print also something here");
pw.flush();// coz u used print();
pw.close(); //close the stream
 
Ted Dong
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply.
So, since I want my output (html) to be written to a file do I have to print the following:
pw.println{"<HTML><HEAD></HEAD><BODY>");
pw.println("the rest of the html....");
Or is the output stored in the buffer somewhere and could I just send the buffer contents to the printwriter?
Thanks.
 
There is no greater crime than stealing somebody's best friend. I miss you tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic