redirecting a servlet response to a file

Is there a way to redirect the response objects output buffer to a file instead of to the client (browser)?

I am using the jsp to process a set of jsp templates (using the RequestDispatcher's include method) and I would like to send the resulting html to a file, NOT to the client.

Any ideas.

Thanks,

Jay

jaywright00@yahoo.com

[381 byte] By [jaywright00] at [2007-9-26 2:00:36]
# 1
Do you need to send the headers and all that stuff to the file as well? If you simply want to send the html to a file, you could use file I/O to send all the output to a FileOutputStream instead of the response output stream.-Derek
beattris at 2007-6-29 8:39:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

The problem is that I'm not generating code with out.println() statements, I'm relying on the servlet engine to generate the html from jsp templates.

For example, my code uses the RequestDispatcher.include(request, response) to access and process a jsp template, which in turn may include another jsp template, and so forth and so on, and it is my understanding that there is an output buffer that is being written and will finally be sent to the client. I want to intercept this and send *that* to a file.

Thoughts?

jaywright00 at 2007-6-29 8:39:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...