There are many ways for a filter to modify a request or response. For example, a filter can add an attribute to the request or can insert data in the response. In the Duke's Bookstore example, HitCounterFilter inserts the value of the counter into the response.A filter that modifies a response must usually capture the response before it is returned to the client. To do this, you pass a stand-in stream to the servlet that generates the response. The stand-in stream prevents the servlet from closing the original response stream when it completes and allows the filter to modify the servlet's response.public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
{
.....//you can handle response object
//PrintWriter out = response.getWriter();
chain.doFilter(request,response);}
{
.....//you can handle response object
//PrintWriter out = response.getWriter();
chain.doFilter(request,response);}
解决方案 »
- 请教sturts2 ModelDriven 相关问题.
- 从springframework的cvs上下载的源码居然有错??
- NUTCH能不能支持多机器分布式采集
- java.security.AccessControlException: access denied (java.io.FilePermission webAPPDOC.doc write)
- 我建了一个XML群,欢迎加入!
- 怎样在已有Hibernate+Struts的基础上加入Spring
- Java 怎么执行操作系统的命令?没人遇到过吗
- 问一个关于EJB的问题????
- 帮忙看看怎么实现这个功能
- EJB的一个问题
- 如何在Struts按数据库数量动态生成文本框
- j2ee容器与框架的区别
就算技术上可行,性能一定顶不住! 老大,用其他方法吧!
<url-pattern>/xxx.jsp</url-pattern>
不放入内存,怎么查找要替换的文本?