7 Replies Latest reply on Jul 24, 2002 7:41 PM by 91662

    jsp:forward is not working

    279723
      Hello!

      I have the following error in my oc4j server(lastest version), when try to use <jsp:forward page="pagina.jsp"/>, can somebody help me?, Thank you.

      Note: When the forward is alone in a page (without other tags) works, but when i have the jsp:forward inside a table not works!


      java.lang.IllegalStateException: Response has already been committed
           at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.EvermindHttpServletResponse.resetBuffer(EvermindHttpServletResponse.java:1776)
           at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:174)
           at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.EvermindPageContext.forward(EvermindPageContext.java:199)
           at nuevasolicitud2.jspService(_nuevasolicitud2.java:118)
           [SRC:/nuevasolicitud2.jsp:92]
           at com.orionserver[Oracle9iAS (9.0.2.0.0) Containers for J2EE].http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
           at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:508)
           at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:255)
           at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:407)
           at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:330)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
           at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:684)
           at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
           at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:735)
           at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:243)
           at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].util.ThreadPoolThread.run(ThreadPoolThread.java:64)

        • 1. re:jsp:forward is not working
          3004
          Javier, Could you please send me a small testcase directly. thanks,

          -Prasad
          • 2. re:jsp:forward is not working
            3004
            here is my e-mail: prasad.shiva@oracle.com
            • 3. re:jsp:forward is not working
              279723
              Here is a case for the problem.
              Thank you!

              Problem: This page is not working in my OC4J sever, but in Tomcat Server 4.0.2 works. What is the problem?
              I think that the use of include and forward are not compatible, ?but only in OC4J?

              pagina.jsp:

              <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
              <html>
              <head>
              <title>Untitled Document</title>
              <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
              </head>

              <body>
              <table width="600" border="0">
              <tr><td colspan="2"> </td></tr>
              <tr><td align="left" width="150"><jsp:include page="pagina1.jsp"/></td>
                   <td>
                        <table align="center" border="0" cellspacing="2" width="400">
                             <tr>
                                  <td>
                                  <%
                                  if (request.getMethod().equals("POST"))
                                  {%> <jsp:forward page="pagina1.jsp"/> <%}
                                  else
                                  {%>
                                  <form action="pagina.jsp" method="post" name="forma">
                                       <table>
                                            <tr>
                                                 <td>Informacisn :</td>
                                                 <td>
                                                      <input name="dato" type="text" size="30" maxlength="30">
                                                      <input type="submit">
                                                 </td>
                                            </tr>
                                       </table>
                                  </form>
                                  <%}
                                  %>
                                  </td>
                             </tr>
                        </table>
                   </td>
              </tr>
              </table>

              </body>
              </html>

              pagina1.jsp:

              <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
              <html>
              <head>
              <title>Untitled Document</title>
              <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
              </head>

              <body>
              <table width="600" border="0">
              <tr> <td colspan="2"> </td> </tr>
              <tr> <td align="left" width="150"> </td>
                   <td>
                        <table align="center" border="0" cellspacing="2" width="400">
                             <tr>
                                  <td>
                                  Hola                    
                                  </td>
                             </tr>
                        </table>
                   </td>
              </tr>
              </table>

              </body>
              </html>

              When the server resolve the post, appeears the follwing error:

              java.lang.IllegalStateException: Response has already been committed
                   at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.EvermindHttpServletResponse.resetBuffer(EvermindHttpServletResponse.java:1776)
                   at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:174)
                   at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.EvermindPageContext.forward(EvermindPageContext.java:199)
                   at appprueba.pagina._jspService(_pagina.java:66)
                   [SRC:/appPrueba/pagina.jsp:18]
                   at com.orionserver[Oracle9iAS (9.0.2.0.0) Containers for J2EE].http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
                   at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:302)
                   at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:407)
                   at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:330)
                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
                   at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:684)
                   at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
                   at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:735)
                   at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.HttpRequestHandler.run(HttpRequestHandler.java:243)
                   at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].util.ThreadPoolThread.run(ThreadPoolThread.java:64)

              • 4. re:jsp:forward is not working
                235006
                I got the similar problem. Does anybody get idea on fixing it? Thanks in advance.

                Regards,

                Kae
                • 5. re:jsp:forward is not working
                  73683
                  This problem has been fixed in the latet version - OC4J v9.0.3 Developer Preview.
                  -Prasad
                  • 6. re:jsp:forward is not working
                    307222
                    I'd like to know what you did to "fix" this. If I understand this correctly, this code will tend to get this exception, and I believe it is deserved.

                    An IllegalStateException happens in this situation if any output has been flushed to the client BEFORE the forward is done. If your "jsp:forward" was close enough to the top of the file, and the buffer size was small enough, then you'd escape without the error. However, if the beginning of the page was flushed to the client, you would get this exception.

                    In general, it's a bad idea to try to forward out of a JSP page that has anything BUT the "jsp:forward" directive.
                    • 7. re:jsp:forward is not working
                      91662
                      That isn't a production version. Is there a work-around
                      for 9.0.2? I didn't have any trouble with it in JRun.
                      This is my last problem to fix in my migration to
                      Oracle 9i AS.