做出了重大回应 [英] Response has aready been committed

查看:101
本文介绍了做出了重大回应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个取消按钮,该按钮过去只是刷新值.现在,我已经将它们转换为刷新或重新加载页面,然后移至只读"页面.因此,将取消按钮更改为调用这样的函数,

I have a cancel button which used to just refresh values. Now I have converted them to refresh or reload the page and move to Read-Only page. So changed cancel button to call a function like this,

function chkArea(){

        var url='<c:out value="${model.contextPath}"/>/abcHandler.do?operation=view;
        document.forms[0].action=url;
        document.forms[0].submit();
    }

现在,当我提交取消时,我会在UI中收到以下消息,

Now when I submit cancel, I get the following message in the UI,

java.lang.IllegalStateException: Response has already been committed    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.EvermindHttpServletResponse.resetBuffer(EvermindHttpServletResponse.java:1892)    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:249)  at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193) at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:284)........

,控制台显示以下错误:

and the console shows the following error:

javax.servlet.ServletException: The "url" attribute illegally evaluated to "null" or "" in &lt;import&gt;
    at com.evermind.server.http.EvermindPageContext.handlePageThrowable(EvermindPageContext.java:899)
    at com.evermind.server.http.EvermindPageContext.handlePageException(EvermindPageContext.java:816)

我在JS或JSP中没有看到任何错误.似乎有什么问题?有什么建议吗?

I don't see any error in the JS or JSP. What seems to be wrong? any suggestions?

推荐答案

首先,问题不在您的示例 1 中的JSP或JS中.问题出在您的servlet收到".../abcHandler.do?operation=view;"时该怎么做?请求.

Firstly, the problem is not in the JSP or JS in your example1. The problem is in what your servlet does when it gets the ".../abcHandler.do?operation=view;" request.

问题是,您正在尝试做一些需要在发送头之后更改HTTP响应头的事情.这就是异常/消息的意思. (一旦servlet框架开始编写响应,就会提交"响应.通常是 something 打开servlet输出流/writer时触发的 ...准备编写响应主体.)

The problem is that you are trying to do stuff that would require a change to the HTTP response headers ... after the headers have been sent. That is what the exception / message is saying. (A response is "committed" once the servlet framework starts writing the response. That is typically triggered when something opens the servlet output stream / writer ... in preparation to writing the response body.)

要给您一个正确的诊断,并就如何解决特定问题提供明智的建议,我们需要查看处理上述请求的Servlet/JSP代码.

To give you a proper diagnosis, and sensible advice on how to fix the specific problem here, we need to see the Servlet / JSP code that is handling the above request.

"URL被非法评估为null"消息很难放置.它可能发生在IllegalStateException之前或之后.

The "url illegally evaluated to null" message is a bit hard to place. It could be happening before the IllegalStateException ... or after it.

(一种可能是您的JSP代码正在尝试使用某些属性意外执行null的操作,这会触发异常.然后,容器的错误处理程序将尝试设置不同的响应状态.. .并且失败了,因为响应已经提交.)

(One possibility is that your JSP code is trying to do something with some 'url' attribute that is unexpectedly null, that is triggering an exception. Then the container's error handler is trying to set a different response status ... and that is failing because the response is already committed.)

总而言之,如果没有更多信息,就不可能弄清楚 root 问题是什么.即代码.

In summary, it is not possible to figure out what the root problem is without more information; i.e. the code.

1-实际上,您缺少url初始化的结束语...但是我认为那只是一个转录错误.

1 - Actually, you are missing a closing quote for the url initialization ... but I assume that's just a transcription error.

这篇关于做出了重大回应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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