When I call the response.sendRedirect() function from a Java Bean I get
a response that already has data in it, the only problem
is that the response shouldn't have any data in it already.  I have a
function call before anything is written to the output buffer
that determines if this page should call a response.sendRedirect().

The weird thing is that only IE has the data that shouldn't be returned
in the html page (from the "view source" option).  Netscape doesn't have
the garbage data when I "view source".

What is going on here?

Info:
Tomcat 3.2.3
jdk1.2.2
NT 4.0

### data that shouldn't be returned ###
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd";>

<html>
<head>

 ... omitted data ...

   CircImage4.src = HTTP/1.1 200 OK
Via: 1.0 MAIL
Connection: Keep-Alive
Content-Length: 1536
Content-Type: text/html
Last-Modified: Thu, 16 Aug 2001 16:54:28 GMT
Servlet-Engine: Tomcat Web Server/3.2.3 (JSP 1.1; Servlet 2.2; Java
1.2.2; Windows NT 4.0 x86; java.vendor=Sun Microsystems Inc.)

### page that should be returned ###
<html>
<head>
... rest of response ...

### relevent parts of index. jsp ###
/******* session operations *******/
try {
    sessionBean.setResponse(response);
    sessionBean.setRequest(request);
    sessionBean.setIP(request.getRemoteAddr());
    sessionBean.setFile(path + name);
    sessionBean.log();
}
catch(IOException ignored) { }
catch(SQLException ignored) { }

// output header,nav
application.getRequestDispatcher("/main.jsp").include(request,response);

// output static page if no processing needed on content
if(proc == null || proc.equals("false")) {

application.getRequestDispatcher("/static.jsp").include(request,response);

}
else {
    application.getRequestDispatcher("/" +
name).include(request,response);
}

// output footer
application.getRequestDispatcher("/footer.jsp").include(request,response);

%>

### relevent portion of SessionBean ###
    public void log() {
         ...
         if(visits == 1) {
             res.sendRedirect("/intro.html");
         }
        ...
    }


Reply via email to