For two days I have tried find out what went wrong. I read here that i should add a return into the code, and I did it, and i still get
java.lang.IllegalStateException: Cannot call sendRedirect() 
     after the response has been committed, Error.
How can I solve this problem?
It happens every time I connect to the database. This is the connect method:
<%!
public  void connect()
{
        try {
            Class.forName("com.mysql.jdbc.Driver");
            String dbURL = "jdbc:mysql://localhost:3306/moti";
            String user = "root";
            String password = "j3o4h5n6y7";
            con =  DriverManager.getConnection(dbURL, user, password);  
            statement = con.createStatement();
        }
        catch(Exception ex) {
            throw new Error(ex);
        }  
}
%>
like in this code block :
            String post = request.getParameter("send");
            if(post != null )
            {
                    connect();
                    statement.execute(add);
                    con.close();
                    response.sendRedirect("fourm.jsp");
                    return;
            }
but in this code block its work perfectly :
    String back = request.getParameter("retrun");
    if(back != null)
    {
        response.sendRedirect("fourm.jsp");
        return;
    }       
 
     
     
    