开发者

Content of the ServletResponseObject or servletresponsewrapper

开发者 https://www.devze.com 2023-03-14 09:55 出处:网络
I have a simple web application running in Tomcat. There is a servlet which is forwarding the request and response to a jsp page which in turn prints something to the browser.

I have a simple web application running in Tomcat. There is a servlet which is forwarding the request and response to a jsp page which in turn prints something to the browser.

Now I have an aspect which captures the response. In this case a HttpServletResponse. Now what I want to do is that I want to capture the reponse and add some co开发者_C百科ntent in it to be displayed in the browser through JSP page.

I dont want to add the content in the jsp page rather I want to add some content without changing my jsp or servlet, using runtime weaving functionality of aspectJ.

I have not been able to figure out any solution yet.Please help me with this.Thanks.


We don't do that with the response. Request object is a better candidate for that. You must understand that JSP is a server-side technology, therefore your request used to be alive in the JSP page.

Moreover, I would suggest you to look at Servlet Filters, those are meant for this kinda scenarios.

0

精彩评论

暂无评论...
验证码 换一张
取 消