• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Manipulating the PrintWriter Object

 
Kingsly Theodar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At the end of JSP, I would like to operate on the PrintWriter object and get the String object out of it.

Is there any way to do this?

Inspecting the Servlet API, I was not able to figure out a way.

Please help.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If what you are trying to do is to capture the response stream, there are better ways to do it.

So, what are you really trying to do?
 
Kingsly Theodar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To elaborate it ...

I have a JSP which generates a report.

While viewed through a browser it works fine!

But now the JSP must be tweaked to generate a HTML report, which should be saved in the server's file system itself.

So I thought I will have the logic,

1. JSP logic to generate HTML
2. Followed by new logic to get the HTML and write it to a new file in the server

So for step 2 of the algorithm I needed to have the Response stream or the printwriter's output, so that I can create a new file with it.

Is that feasible?

Please help.

Thanks in advance
[ March 24, 2006: Message edited by: Kingsly Thewdar ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Search for the terms "servlet filter" and "response wrapper". That might lead you to a technique that you could employ.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic