jsp+servlet跳转问题: Cannot call sendRedirect() after the response has been committed开始先访问jsp页面,判断是否能够拿到session,拿不到就重定向到servlet,servlet拿到之后再重定向到jsp.问题:执行到jsp的if(goodsInfo
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/30 18:36:52
![jsp+servlet跳转问题: Cannot call sendRedirect() after the response has been committed开始先访问jsp页面,判断是否能够拿到session,拿不到就重定向到servlet,servlet拿到之后再重定向到jsp.问题:执行到jsp的if(goodsInfo](/uploads/image/z/12754233-9-3.jpg?t=jsp%2Bservlet%E8%B7%B3%E8%BD%AC%E9%97%AE%E9%A2%98%3A+Cannot+call+sendRedirect%28%29+after+the+response+has+been+committed%E5%BC%80%E5%A7%8B%E5%85%88%E8%AE%BF%E9%97%AEjsp%E9%A1%B5%E9%9D%A2%2C%E5%88%A4%E6%96%AD%E6%98%AF%E5%90%A6%E8%83%BD%E5%A4%9F%E6%8B%BF%E5%88%B0session%2C%E6%8B%BF%E4%B8%8D%E5%88%B0%E5%B0%B1%E9%87%8D%E5%AE%9A%E5%90%91%E5%88%B0servlet%2Cservlet%E6%8B%BF%E5%88%B0%E4%B9%8B%E5%90%8E%E5%86%8D%E9%87%8D%E5%AE%9A%E5%90%91%E5%88%B0jsp.%E9%97%AE%E9%A2%98%3A%E6%89%A7%E8%A1%8C%E5%88%B0jsp%E7%9A%84if%28goodsInfo)
jsp+servlet跳转问题: Cannot call sendRedirect() after the response has been committed开始先访问jsp页面,判断是否能够拿到session,拿不到就重定向到servlet,servlet拿到之后再重定向到jsp.问题:执行到jsp的if(goodsInfo
jsp+servlet跳转问题: Cannot call sendRedirect() after the response has been committed
开始先访问jsp页面,判断是否能够拿到session,拿不到就重定向到servlet,servlet拿到之后再重定向到jsp.问题:执行到jsp的
if(goodsInfos==null){
response.sendRedirect("GoodsInfo_con?function=goodsList");
}这个if就抛异常了: Cannot call sendRedirect() after the response has been committed
.servlet都进不去了.在线求解
上面的图是jsp
下面的是servlet
jsp+servlet跳转问题: Cannot call sendRedirect() after the response has been committed开始先访问jsp页面,判断是否能够拿到session,拿不到就重定向到servlet,servlet拿到之后再重定向到jsp.问题:执行到jsp的if(goodsInfo
哎,不知道在说什么啊.
不过看起来是你在页面用了response.sendRedirect() .你之前的代码是不是有跳转啊?
在页面提交,你可以用javascript啊.可以用form的submit();
这个提示就是说,你response已经提交了不能在用函数sendRedirect() ,可以尝试别的跳转方法