Multiple includes with RequestDispatcher

  • Thread starter Paul Vincent Craven
  • Start date
P

Paul Vincent Craven

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
(e-mail address removed)
http://www.cravenfamily.com
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top