浏览器显示不完整的 JSP 数据

发布于 2024-08-26 06:09:29 字数 442 浏览 4 评论 0原文

我正在使用 JSP、Struts 1.3 和 Apache Tomcat 5.5。 由于某种原因,JSP 的响应被截断并且未显示完整信息。 从有问题的 JSP 页面生成的类看起来很好。 Catalina 的日志中没有记录任何错误。 我不知道如何解决这个问题。

更新:我确定我正在正确的日志中查找错误 ($CATALINA_HOME/logs)。此外,我正在将一些日志消息写入自定义日志文件。两者都没有提及此错误。错误仅发生在一个特定页面,并且内容在同一位置被截断。如果我打印相同的实体几次,页面输出看起来很完美。如果我在此位置之前删除一些输出,则剪切边界会移动:内存分配问题?我已经检查过,页面缓冲区大小不会影响页面输出。在这个页面中,我使用了 include 指令,并且我得到了一些信息,如果生成的 servlet 的大小超过 64 KB,您的 JSP 编译可能会失败。 Servlet 生成得很好,但我被卡住了。

I am using JSP, Struts 1.3 and Apache Tomcat 5.5.
For some reason response from JSP is being truncated and complete information is not shown.
Class generated from the problem JSP page looks just fine.
There are no any errors logged in Catalina's logs.
I have no idea how this issue can be fixed.

Update: I'm sure that I'm looking in the right log for errors ($CATALINA_HOME/logs). Besides I'm writing some log messages to custom log file. There are no any mentions about this error in both of them. Error happens only in one specific page and content is truncated in the same place. If I print the same entity few times page output looks perfect. If I remove some outputs before this place the cut border is shifted: Memory allocation issues? Page buffer size doesn't effect on page output, I've checked. In this page I use include directive and I've met some information that if the size of generated servlet exceeds 64 KB, your JSP compilation will likely fail. Servlet generated just fine and I'm stuck.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

记忆で 2024-09-02 06:09:29

根据您的更新:

如果我在此位置之前删除一些输出,则剪切边框会移动

看起来在关闭输出流期间出现了问题。如果没有某个过滤器用自定义实现替换 HttpServletResponse ,那么我会检查整个过滤器链,而自定义实现又实现得很差,例如它没有正确委托 close( ) 方法到“原始”输出流/编写器。尝试禁用过滤器并重新测试。另请尝试将以下行添加到 JSP 的底部,看看是否可以解决问题:

<% response.getWriter().flush(); %>

As per your update:

If I remove some outputs before this place the cut border is shifted

It look like that something went wrong during closing the outputstream. I'd check the entire filter chain if there isn't some filter which replaces the HttpServletResponse with a custom implementation which in turn is poorly implemented, e.g. it doesn't properly delegate the close() method to the 'original' outputstream/writer. Try disabling the filter and retest it. Also try to add the following line to the bottom of the JSP to see if it fixes the problem:

<% response.getWriter().flush(); %>
七堇年 2024-09-02 06:09:29

我遇到过类似的问题,其中浏览器(调试器/页面源)中仅显示(下载)JSP 文件的一部分。令人担忧的是,这种情况并不总是发生。

我发现由于连接超时而引发了 NullPointerException ,这最终导致服务器仅发回 JSP 的一部分。

因此,正如其他人的评论中所建议的那样,请正确查看您的日志。

I've had the similar problem Where Only part of the JSP file is displayed(downloaded) in the Browser(Debugger/Pagesource). The worrying part was that it wasn't always happening.

I found that there was an NullPointerException being thrown because of a connection Timeout which ultimately was responsible for Sending only part of JSP back by the Server.

So, as advised in the comments by others, do look into your logs properly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文