2017-08-07 57 views
0

我有一个实现过滤器自定义过滤器和我换这样包装的响应不渲染JSP内容

HttpServletResponse responseWrapper = new ContentCachingResponseWrapper((HttpServletResponse) response); 
chain.doFilter(request, responseWrapper); 
后,我打开本地主机,我什么也看不见,只有白色屏幕

与ContentCachingResponseWrapper的响应。

<html> 
<head><head> 
<body></body> 
</html> 

如果我评论的ContentCachingResponseWrapper和使用不应对它环绕

chain.doFilter(request, response); 

那么我的JSP页面正确呈现。

任何人都可以解释发生了什么?

+0

user7294900,谢谢!我已将此添加到拦截器中,但我忘了将其添加到我的过滤器中 – John

回答

0

加入((ContentCachingResponseWrapper) responseWrapper).copyBodyToResponse();chain.doFilter(requestToCache, responseWrapper);问题后,解决了