Meaningless Drivel is fun!
The moose likes Servlets and the fly likes requestDispatcher.forward() forgets path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "requestDispatcher.forward() forgets path" Watch "requestDispatcher.forward() forgets path" New topic

requestDispatcher.forward() forgets path

Mike Nightsky
Ranch Hand

Joined: Aug 18, 2001
Posts: 48
Is this suppoused to do or is this a bug in tomcat.
If i forward a request via the requestDispatcher the requestUri has changed to the parameter given to the requestdispatcher.

if it is suppoused to do it like that, is the original uri stored somewhere in the request, or have i put it into a parameter to keep it.


Win the opportunity to make money on the Internet<br /><a href="" target="_blank" rel="nofollow"></a>
Zeeshan Faisal

Joined: Apr 21, 2004
Posts: 5
I think that there is some problem in the code that u wrote in ur application because there is no such bug in Tomcat. I have checked it
Mike Nightsky
Ranch Hand

Joined: Aug 18, 2001
Posts: 48
I forward the request to a servlet via the invokerservlet from tomcat.
If i look at the requestURI in the called servlet i get the path with which i called the Requestdispachter ("/servlet/")
but i want the original path ("/company/something")

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
You should not be using the invoker servlet for any serious work. See the JavaRanch FAQ on the subject of the invoker.
Your DoSomething servlet needs to be defined in web.xml with the URL you want the RequestDispatcher to recognize.
Mike Nightsky
Ranch Hand

Joined: Aug 18, 2001
Posts: 48
i have about 200 servlets and the number is growing.
i use the invoker because i dont want to stop and start the server if i add some functionallity.
I agree. Here's the link:
subject: requestDispatcher.forward() forgets path
It's not a secret anymore!