java.lang.IllegalStateException: getWriter() has already been called for this response

This error comes when a Servlet calls the getOutputStream() method on response object for writing something after calling the include() method. Suppose a Servlet calls the include() method to load the response of a JSP. Since JSP has already written the response on it hence again opening OutputStream on response object is illegal, you get the java.lang.IllegalStateException: getWriter() has already been called for this response error. This error also comes when you try to include response of another Servlet and than tries to write something on output stream again. In short, your Servlet should never write anything on response object after calling the include() method. 
Read more »