File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes absolute or relative Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "absolute or relative" Watch "absolute or relative" New topic

absolute or relative

suman deb
Ranch Hand

Joined: Jul 14, 2005
Posts: 54
What URL (absolute or relative) is used in RequestDispatcher forward ?
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

that depends on whether you give a relative or absolute reference to the resource.
Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
With the RequestDispatcher, "absolute" is really relative to your web application root. If its the ServletContext's RequestDispatcher, you have to use absolute. With the request's RequestDispatcher you can use relative to the request URI if you leave out the "/" at the beginning.

I agree. Here's the link:
subject: absolute or relative
It's not a secret anymore!