Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Struts - A MVC web framework
Tomcat - JSP/Servlet container
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
JSP - A mailing list about Java Server Pages specification and reference
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
response.sendRedirect problem in Tomcat 5.0.18

response.sendRedirect problem in Tomcat 5.0.18

2004-02-01       - By Ben Souther

 Back
You'll need to structure your code so that you either write to the out stream
or perform a sendRedirect.  There has never been a version of Tomcat that
would allow otherwise.  This is the same in PHP, ASP, and I imagine any other
web scripting language.

A sendRedirect does nothing more than send back a bodyless header with a
"Location: url"  parameter.

You can't send a header once you've started writing to the body of the
message.  You also can't write to the body after sending a redirect (which is
why you need to add a "return" statement just after the redirect).



On Sunday 01 February 2004 06:55 am, you wrote:
> Hi Ben,
>
> Thanks for your assistance, I added "return ;" statements directly after
> the redirects but this didn't stop the errors.  I am currently having the
> code checked and will let you know what eventuates.
>
> Should there be no "out.print" statements above the "response.sendRedirect"
> lines in the jsp code ?
> There are also "out.write" statements in the jsp code above the redirect
> lines, could these also cause a problem ?
>
> The code was not erroring like this when using Tomcat 4.1.24 or 5.0.16, do
> you think this is due to Tomcat 5.0.18 being more strict with syntax ?
>
> Thanks for your time,
>
> Regards
> Anthony
>
>
> From: Ben Souther <bpsouther@(protected)>
>
> >Reply-To: bpsouther@(protected)
> >To: "Tomcat Users List" <tomcat-user@(protected)>
> >Subject: Re: response.sendRedirect problem in Tomcat 5.0.18
> >Date: Sat, 31 Jan 2004 23:53:41 -0500
> >
> >On Saturday 31 January 2004 11:32 pm, you wrote:
> > > at org.apache.jsp.product_jsp._jspService(product_jsp.java:283)
> >
> >If you go into your work directory, and look at product_jsp.java line 283,
> >you will see exactly what's causing the problem.
> >
> >Without seeing your code, I can't be sure what the problem is but 99% of
> >the
> >time when I see an illegal state exception it caused by one of two things.
> >
> >Either you've written someting to the out stream before redirecting
> >(setting
> >content type or any out.print statements)  or you didn't  put a return
> >statement just after the redirect.
> >
> >If neither of these is the case and you can post your code, attach your
> > JSP and the product_jsp.java code I'll take a stab at it.
> >
> >-Ben
> >
> >-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
> >For additional commands, e-mail: tomcat-user-help@(protected)
>
> __ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
> Hot chart ringtones and polyphonics. Go to
> http://ninemsn.com.au/mobilemania/default.asp

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.