RequestDispatcher.forward() not throwing IllegalStateException.

  • Follow


Hello group,

I am preparing for the SCWCD exam. I read that
RequestDispatcher.forward() throws an IllegalStateException
if it is called after anything has been committed to the output.
However, when I run the following code in my doGet:

    RequestDispatcher dispatcher =
          req.getRequestDispatcher("test.html");

    PrintWriter out = resp.getWriter();
    out.write("Output committed.");
    out.flush();

    dispatcher.forward(req, resp);

I get "Output committed." written to the resulting page. I am
puzzled. I am using NetBeans 5.0 to test this. Is this a bug?

Thanks in advance for any help.
Regards,

Jan van Mansum.

0
Reply janvanmansum (11) 7/23/2006 10:18:19 AM


0 Replies
26 Views

(page loaded in 0.054 seconds)


Reply: