Send redirect is done via sending an error code and an error message, you
can't send an error code AND an HTML response.
You have two options, forget the ok message. Or build a complete response
that uses either a javascript of a meta tag to perform the redirection

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of ahfei
Sent: Thursday, May 11, 2000 10:39 AM
To: [EMAIL PROTECTED]
Subject: sendRedirect problem


dear all
 i have a problem about jsp. follow is my code:
##############################################
//there are some other lines ,but haven't using the "Out" object.
   if (flag) {
      out.println("ok");
       response.sendRedirect("club/register_club_success.htm");
   }else{
       response.sendRedirect("/club/register_club_error.htm");
   }

######################################################

But sometimes it doesn't work ! my tomcat server issue  some errors:


#####################################
Internal Servlet Error:

java.lang.IllegalStateException: Cannot forward as OutputStream or Writer
has already been obtained
        at
org.apache.tomcat.core.RequestDispatcherImpl.forward(RequestDispatcherImpl.j
ava:130)
        at
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:357)
        at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:381)
        at
jsp._0002fjsp_0002fsave_0005fprofile_0002ejspsave_0005fprofile_jsp_6._jspSer
vice(_0002fjsp_0002fsave_0005fprofile_0002ejspsave_0005fprofile_jsp_6.java,
Compiled Code)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java,
Compiled Code)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled
Code)
        at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
va, Compiled Code)
        at
org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java,
Compiled Code)
        at org.apache.jasper.runtime.JspServlet.service(JspServlet.java,
Compiled Code)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled
Code)
        at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
Compiled Code)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java, Compiled
Code)
        at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java, Compiled Code)
        at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java,
Compiled Code)
        at java.lang.Thread.run(Thread.java, Compiled Code)
##########################################################

Can anybody help me? thanks in advance!





            ahfei
            [EMAIL PROTECTED]

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to