Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes Servlet RequestDispatcher Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet RequestDispatcher Problem" Watch "Servlet RequestDispatcher Problem" New topic
Author

Servlet RequestDispatcher Problem

brajendra mishra
Greenhorn

Joined: Oct 08, 2007
Posts: 2
Hi,
I am beginer having a servlet code:
RequestDispatcher rd=application.getRequestDispatcher("/RequestDisTwo");
rd.include(request,response);
is working fine.
but instead of include if i am writing :
rd.forward(request,response);
getting Exception:
exception

javax.servlet.ServletException: Servlet execution threw an exception


root cause

java.lang.NoSuchMethodError: javax.servlet.ServletResponse.resetBuffer()V
RequestDisOne.doPost(RequestDisOne.java:23)
RequestDisOne.doGet(RequestDisOne.java:9)
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
can anybody help me.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I havr the feeling there are two things going on here.

Firstly, 'forward' requires all of the response to come from the forward resource. If anything has already been sent to the client and is buffered, the buffer gets cleared first. If the buffer cannot be cleared, an Exception is thrown. This is the initial problem you should solve: make sure nothing is getting sent.

When clearing the buffer, javax.servlet.ServletResponse.resetBuffer() is called. If you check the API, this method has been in the Servlet spec since version 2.3, and Servlets 2.3 have been supported since Tomcat 4.1.36

This is the second issue, and I have the feeling you have an incorrect jee or Servlet JAR on your file system somewhere...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet RequestDispatcher Problem
 
Similar Threads
Not able to add values in a database
Exception in Servlet
retreiving String array from servlet
HTTP Status 500 - error running servlet with JSP
servlet exception occurs at "dispatcher.forward()"