Paul,

>Hello all!
>
>We're using JSP1.0 under JWS2.0beta2.
>
>We've been trying to get "page forwarding" working.  Specifically, to get
>one JSP page to simply forward over to another JSP page without doing a
>round-trip to the client browser.
>
>The simplest JSP file I've come up with for this is a 2-liner that says:
><%@ page language="java" %>
><jsp:request forward="http://hostname/.../other.jsp" />
>
>When I hit the page, after the "recompile delay" I get:
>
>Error during JSP page parsing
>Unknown exception: java.lang.IllegalStateException: Can not forward to
>servlet jspServlet : OutputStream or writer has been obtained
>
>...At first, I thought this was because of the stuff above the redirect
>being sent as HTML, but I've eliminated almost everything!
>
>So, What am I missing?

I ran into the same problem, and believe there is a bug in the
way JWS generates the servlet from the JSP.  If you take a look
at the code generated from:

test.jsp
========
<jsp:request forward="/mod1.jsp" />


in $JWS/tmpdir/default/pagecompile/jsp/_test.java,
you'll see something like the following:

package pagecompile.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
...

public class _test extends HttpJspBase {


    public void _jspService(HttpServletRequest request, HttpServletResponse
 response)
        throws IOException, ServletException {

        HttpSession session = null;
        ServletContext application;
        ServletConfig config;
        JspWriter out = null;
        String  _value = null;
        try {

            application = getServletConfig().getServletContext();
            config = getServletConfig();
            session = request.getSession(true);
            out = new JspWriter(response.getWriter(), 8192);
            response.setContentType("text/html");

            out.write("");
            application.getRequestDispatcher("/mod1.jsp").forward(request,
response);
            out.write("\r\n");

        } catch (Throwable t) {
            throw new JspException("Unknown exception: "+t);
        } finally {
        }
        out.flush();

As you can see, a JspWriter is created, and the empty string is output
before it forwards the request.  Since the servlet API spec says you
can't do that, I don't see how this can work.  Maybe there is some
option for suppressing the JspWriter creation?

>Thanks in advance for your guidance!
>-Paul Reiber
>

    -- Bill

--
Bill O'Keefe                                     [EMAIL PROTECTED]
Open Market, Inc.                            http://www.openmarket.com/
One Wayside Road                                 TEL: 781.359.7296
Burlington, MA 01803                             FAX: 781.359.8200

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to