Multiple includes with RequestDispatcher

Discussion in 'Java' started by Paul Vincent Craven, Aug 29, 2003.

  1. I'm trying to do something portal-like with a servlet. I want to
    output html from the servlet, and put the content of multiple JSP's as
    well.

    My problem is that only one call to request.getOutputStream() is
    allowed. This is per the spec, and both Tomcat and Websphere will
    throw an exception:

    java.lang.IllegalStateException: getOutputStream() has already been
    called for this response

    Because RequestDispatcher.include calls getOutputStream, I can only do
    one include. I also can't combine it with any other input. Is there
    another way?

    If I could capture RequestDispatcher output into a buffer I could dump
    that out easily. But the only way I know to do that is to make another
    call to the webserver, and I don't want to do that!

    Any suggestions would be appreciated. Thanks!

    Paul Vincent Craven

    http://www.cravenfamily.com
    Paul Vincent Craven, Aug 29, 2003
    #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:
    571
    Nigel Wade
    Dec 10, 2003
  2. Ryan Stewart

    RequestDispatcher.include() behavior

    Ryan Stewart, May 20, 2004, in forum: Java
    Replies:
    0
    Views:
    477
    Ryan Stewart
    May 20, 2004
  3. DiscoStu
    Replies:
    1
    Views:
    500
    Erwin Moller
    Jul 20, 2004
  4. John English
    Replies:
    6
    Views:
    3,913
    Andrea Desole
    Jul 19, 2005
  5. Replies:
    2
    Views:
    508
    Tor Iver Wilhelmsen
    Aug 18, 2005
Loading...

Share This Page