actually i do have a question in reference to this. And i figured instead of opening a new thread, i'll ask here as the OP's question seems related to what i want to.
What i want to do is to insert a hidden form field in all my pages dynamically by "scanning" the response object and then if the response content has <form> tags in it, then for each form insert the hidden field. I could do this manually, but way too many jsp's and a dynamic solution would be much more elegant.
I have created wrapper class for the response object and another wrapper for ServletOutputStream. The problem i have are two:
a) i can't seem to get the content read out from the response, without preventing the response jsp to display in the browser, as the front end browser only displays blank screen.
b) is this possible? meaning injecting code into the stream as it is going to the end user? I looked at the compressione example in the Head First Servlets and JSP, but i have not been able to find it helpful in my case as i'm trying to add data to the response.
Okay i have figured the above out, but now i'm running into another issue. Once i wrap the output stream, whatever is the last tile insert definition in my jsp, it is not getting processed.
By this i mean that the content of the last tile insert is missing from the page on the front end. If input a dummy tile insert after the last "actual" tile insert, it works and i am able to see the content of that tile.
Has anybody else experienced this behavior? I have looked through my implementation and i am not prematurely closing the stream anywhere so not sure what is happening. I am using Struts 1.2.*, and not sure if this is related to that version of struts or my implementation. In my WAS server logs i do see the message "****.jsp intialization successful." So i know it's getting acquired by the webserver.
Any feedback is appreciated. Thanks.
subject: Modify servlet output to include standard data