Does content that has already been written to the out stream affect
forwards?  For example the following JSP:

<%@page session="true" language="java" %>
<%!
        boolean bSomething = false;
        boolean doSomething()
        {
                return bSomething;
        }
%>
<%

        if ( doSomething() )
        {
%>
                <jsp:forward page="./success.html" />
<%
        }
        else
        {
%>
                <jsp:forward page="./error.html" />
<%
        }
%>

will produce the following code in _jspService when using ServletExec 2.2:

        out.print( "\r\n" );
        out.print( "\r\n" );
        if ( doSomething() )
        {
                out.print( "\r\n\n\n" );
                if ( true )
                {
                        pageContext.forward( "./success.html" );
                        return;
                }
                out.print( "\r\n" );
        }
        else
        {
                out.print( "\r\n\n\n" );
                if ( true )
                {
                        pageContext.forward( "./error.html" );
                        return;
                }
                out.print( "\r\n" );
        }
        out.print( "\r\n\r\n\r\n" );

Ignoring the inefficiency of this, I just want to make sure that the
extraneous out.print() calls are not going to mess up the data stream that
finally needs to get to the client.

Dana H. P'Simer, Jr.
678-441-7547
[EMAIL PROTECTED]
[EMAIL PROTECTED]


-----Original Message-----
From: Arun Thomas [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 24, 2000 11:34 AM
To: [EMAIL PROTECTED]
Subject: Re: forward


Ghosh,

The forward tag is invisible to the browser.  As far as the browser is
concerned, it requested a specific resource form
the server (identified by the address in the browser).  That resource was
returned - the actual contents of that resource
(in this case, obtained on the server side by forwarding to page 2) don't
matter.  If you want to see the address of page
two in the browser, you must use a sendRedirect to make the browser request
resource page 2.

-AMT

> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Arannyak Ghosh
> Sent: Saturday, January 22, 2000 2:38 AM
> To: [EMAIL PROTECTED]
> Subject: jsp:forward
>
>
> Hi all,
> I wanteed to know the way jsp:forward works. I am using this to
> forward from
> say page1 to page 2.
> But the address in the browser still says page1 despite the page2 being
> successfully loaded.
> Thanx
> ghosh
>
> ==================================================================
> =========
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> FAQs on JSP can be found at:
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

PSimer, Dana.vcf

Reply via email to