JSP out.flush()问题 [英] JSP out.flush() issue

查看:71
本文介绍了JSP out.flush()问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天有一个奇怪的问题.我有一个head.jsp(以out.flush结尾)正在被其他页面包含.大多数页面对此都没有问题.但是我的页面之一在jboss 4.2.2 GA上出现IllegalStateException失败.

I had a weird problem today. I have a head.jsp ( ending with out.flush ) which is being included by other pages. most of the pages doesn't have problem with this out.flush(); but one of my page is failing with IllegalStateException on jboss 4.2.2 GA.

我检查了相关的Java文件ResponseFacade.java.并看到由于if(isCommitted)检查而发生该问题.

I checked the related java file ResponseFacade.java I think. And see that problem occurs because of if (isCommitted) check.

我刚刚从问题页面中删除了include语句,它现在可以正常工作. 但是问题是;为什么只有一个页面有其他页面,其他页面对此页面没有问题?

I just removed the include statement from my problemmatic page and it is working now. But the question is; why the other pages does not have problem with this page while the only one page has ?

或其他页面是否包含jsp文件.我需要在此包含的页面中使用out.flush()吗?

or if a jsp file is being included by other pages. do I need to out.flush() in this included pages ?

推荐答案

您的Web容器当然会在需要时刷新响应的输出流.您不需要任何呼叫冲洗.顺便说一句,无论如何,JSP中的Java代码都是不好的做法.

Your web container will of course flush the response's output stream when it needs to. You don't need any call to flush. BTW, Java code in JSP is bad practice anyway.

这篇关于JSP out.flush()问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆