File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Manipulating the PrintWriter Object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Manipulating the PrintWriter Object" Watch "Manipulating the PrintWriter Object" New topic
Author

Manipulating the PrintWriter Object

Kingsly Theodar
Greenhorn

Joined: Feb 21, 2004
Posts: 19
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

Joined: Jan 10, 2002
Posts: 60057
    
  65

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?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Kingsly Theodar
Greenhorn

Joined: Feb 21, 2004
Posts: 19
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

Joined: Jan 10, 2002
Posts: 60057
    
  65

Search for the terms "servlet filter" and "response wrapper". That might lead you to a technique that you could employ.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Manipulating the PrintWriter Object
 
Similar Threads
Why can't get the object "out" in this way?
some confusion
Getting JSP's HTML output inside the same JSP
why String vlass reference variable holds content ?
Writing to a file