tags:

views:

855

answers:

2

I need to capture the HTML and do some post processing on the HTML data before it is finally output to the user. The final HTML document is actually composed of many JSP includes (12 or so), so there is some existing logic actually in the JSP. But I need the HTML that is generated. This has to be done on the server-side.

I have only thought of 2 options.

  1. Use a JSP tag library and capture the output through some kind of body capture or something. But the JSPs are kind of a mess with so much code that ideally I was trying to avoid modifying any of the JSP pages.

  2. Use the URL/Net libraries and connect to this page through a http request. But that is also kind of messy.

+2  A: 

If I understand what you want to do then you should be able to do this by using a servlet filter. Check out the tried and true gzip example to see how to capture and modify the entire output stream.

carson
A: 

Good response, that is what I need.

Berlin Brown