title: forward and sendRedirect issue. "Cannot call sendRedirect() after the response has been committed"
body: <p>i want to implement this..<br/>In my page1.jsp i have a link and the link triggers a servlet <br/></p>
  
  <pre><code>    &lt;a href="Servlet"&gt;link1&lt;/a&gt;
  </code></pre>
  
  <p>So, when the user press the link1, the servlet among other things i want to do two things.<br/><strong>1</strong> Pass to the next page page2.jsp an object and <br/><strong>2</strong> redirect the user to the page2.jsp<br/><br/>In the Servlet i wrote:<br/></p>
  
  <pre><code>     request.setAttribute("cis", myObjet);
       RequestDispatcher disp = getServletContext().getRequestDispatcher("/page2.jsp");
       disp.forward(request, response);
       response.sendRedirect("page2.jsp");
  </code></pre>
  
  <p>After i run the application, i get an error in console that says:<br/></p>
  
  <blockquote>
    <p>Cannot call sendRedirect() after the response has been committed</p>
  </blockquote>
  
  <p>i read some topics relevant to this, but i havent solve it. Also the application continue to work, although i have this error in the console... thank you a lot!</p>