A couple of things:

1)      Generally, you cannot do a send redirect if you have already written
something to the output stream.

2)      Unlike ASP, sendRedirect() does not terminate processing of the current
servlet, or JSP Page. You need to explicitly put a RETURN statement in.

In your case, since you are doing the send re-direct from the servlet, what
you should do is set an attribute on the request, and have the JSP page
check for the attribute. If the attribute is present, signalling a redirect,
the JSP page should similarly execute a return statement.

George Sexton
MH Software, Inc.
Home of Connect Daily Web Calendar Software
http://www.mhsoftware.com/connectdaily.htm
Voice: 303 438 9585


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 03 September, 2002 12:04 PM
To: [EMAIL PROTECTED]
Subject: problem using sendRedirect() in a servlet jsp:include'd into a
jsp page


Hi all, I'm having a little problem...

I have a jsp page, lookup.jsp, that <jsp:include>'s a servlet,
LookupServlet.  The jsp page is mainly
just to <jsp:include> the static html content, and the servlet does all the
processing involved in the
application...  the problem is, I want to move to a page called confirm.jsp
after the lookup finishes...

My first thought was to use sendRedirect() in the servlet... but this
doesn't appear to work, and I'm
not sure why.  sendRedirect does not throw any exception, but by the same
token, the redirect doesn't
happen.

It doesn't appear to be a browser issue, as this happens with Mozilla 1.1
and Internet Explorer 6.0...
It also doesn't seem to be a manifestation of the old bug with sendRedirect
() not working with mod_jk,
as I wrote a seperate test servlet that does nothing but a redirect, and it
works fine ( not being included
inside a jsp page though ).

My gut feeling is that my problem is mainly caused by the fact that my
servlet is not called directly,
but is included in that jsp page...  can anybody confirm or deny this, or
offer any other insight as
to what might be happening?

This is using Apache 1.3 + Tomcat 4.0.4 + mod_jk on Windows NT 4.0

Thanks,


Phillip Rhodes
Application Designer
Voice Data Solutions
919-571-4300 x225
[EMAIL PROTECTED]

Those who are willing to sacrifice essential liberties for a little order,
will lose both and deserve neither. - Benjamin Franklin

This country, with its institutions, belongs to the people who inhabit it.
Whenever they shall grow weary of the existing government, they can
exercise their constitutional right of amending it, or exercise their
revolutionary right to overthrow it.  - Abraham Lincoln

No citizen shall be denied the right to bear arms, if as a last resort, to
protect themselves from tyranny in Government. - Thomas Jefferson


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to