RequestDispatcher.forward() not throwing IllegalStateException.

J

Jan van Mansum

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top