RequestDispatcher.forward() not throwing IllegalStateException.

Discussion in 'Java' started by Jan van Mansum, Jul 23, 2006.

  1. 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.
     
    Jan van Mansum, Jul 23, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Will Handley
    Replies:
    1
    Views:
    598
    Nigel Wade
    Dec 10, 2003
  2. kinga
    Replies:
    1
    Views:
    542
    John C. Bollinger
    May 19, 2005
  3. Harry
    Replies:
    1
    Views:
    798
    Viator
    Dec 22, 2005
  4. harryos
    Replies:
    2
    Views:
    1,752
  5. Replies:
    0
    Views:
    601
Loading...

Share This Page