This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Servlets and the fly likes RequestDispatcher.include( ) - help! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "RequestDispatcher.include( ) - help!" Watch "RequestDispatcher.include( ) - help!" New topic

RequestDispatcher.include( ) - help!

Gail Mikels
Ranch Hand

Joined: May 07, 2001
Posts: 634
I'm working with the RequestDispatcher's include() method. In my first servlet, I'm using the PrintWriter before & after the call to include(), and every documentation I've seen says that this should work, but for some reason, it doesn't!
The servlet that I'm including creates an html tag, gets a PrintWriter, and sends the tag to out.println().
I'm getting the tag back in my first servlet, but none of the PrintWriter statements in the first servlet work after that point. Any hints??
Thank you,
[ August 23, 2002: Message edited by: Elaine Micheals ]

Gail Mikels
Gail Mikels
Ranch Hand

Joined: May 07, 2001
Posts: 634
never mind... Here's what happened - the second servlet was opening, and CLOSING a PrintWriter. I omitted the line in the second servlet which closed the PrintWriter, and everything's happy now!
It is sorta covered in the JavaRanch Style Guide.
subject: RequestDispatcher.include( ) - help!
It's not a secret anymore!