jsp+servlet的问题,提交时报错:Cannot forward after response has been committed这句话的意思大概是提交response后不能再转向,是吧?是不是我前面response.setContentType("text/html"); response.setCharacterEncoding("utf-8");

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/27 08:11:19
jsp+servlet的问题,提交时报错:Cannot forward after response has been committed这句话的意思大概是提交response后不能再转向,是吧?是不是我前面response.setContentType(
xYSPǿJ3Eo໓VK SA]-lR؀(K+]ܛɯI83$99iC]#Ivk}s4iRoXyO*[QNmD QUEtGHe|=}K;rݍ/ D*&)Zm|çKC޴zn4ztv|rtM d C0(ɪP eʼn O5_|ydk԰߃iҤ]W.. @#q̂-a/߅X8+'[C'fp>8ٝŵ]{a xg\n밄2&4:>ك:)w9WsZ<F͝*yN^z~њOÕ50;Ck V0qZq}lҤ[g3X$wNy- AcnEV}rJ4<\J

jsp+servlet的问题,提交时报错:Cannot forward after response has been committed这句话的意思大概是提交response后不能再转向,是吧?是不是我前面response.setContentType("text/html"); response.setCharacterEncoding("utf-8");
jsp+servlet的问题,提交时报错:Cannot forward after response has been committed
这句话的意思大概是提交response后不能再转向,是吧?是不是我前面response.setContentType("text/html");
response.setCharacterEncoding("utf-8");的原因啊?如果是这里的问题,那么怎么做“先提示正在跳转,然后在跳转到目标页面”啊?高手们帮忙

看图

jsp+servlet的问题,提交时报错:Cannot forward after response has been committed这句话的意思大概是提交response后不能再转向,是吧?是不是我前面response.setContentType("text/html"); response.setCharacterEncoding("utf-8");
对于Cannot forward after response has been committedCannot forward after response has been committed这个错误,有了更加深刻的认识这个是错误是由于response多次提交或者是由于有页面显示后仍然含请求转向产生的,就是说程序在return之前就已经执行了跳转或者执行过response,之后遇到return的话,程序想再次执行跳转,也就是重定向,这时功能也许会实现了,但是控制台会报错,所以控制好跳转是很重要的,我现在的解决办法还是加return null,