Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Multiple includes with RequestDispatcher

Thread Tools

Multiple includes with RequestDispatcher

Paul Vincent Craven
Posts: n/a
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

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 Removed)
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Default Document for Directory with RequestDispatcher Java 2 08-18-2005 02:24 PM
[J2EE] RequestDispatcher.include problem John English Java 6 07-19-2005 07:54 AM
RequestDispatcher executing in wrong directory DiscoStu Java 1 07-20-2004 12:47 PM
RequestDispatcher.include() behavior Ryan Stewart Java 0 05-20-2004 03:57 AM
RequestDispatcher.forward() Taking 30 Seconds Each Will Handley Java 1 12-10-2003 11:52 AM