Cannot forward after response has been committed 错误的解决方法

HTTP Status 500 -

 

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

java.lang.IllegalStateException: Cannot forward after response has been committed
	com.goodsshop.servlet.RegisterLogin.doRegister(RegisterLogin.java:135)
	com.goodsshop.servlet.RegisterLogin.doPost(RegisterLogin.java:37)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

 

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.

 

 

之所以会出现上面的错误,我也是看别人的解决方法,后才突然发现的

 

我的发现是这样的:

 

这错误是由于你的servlet类代码中多次同时并行的response和forward所致的!!!!!

 

 

解决方法:请用if语句进行分层!!!!!!!

你可能感兴趣的:(java,apache,tomcat,servlet)