A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCA Java SE 8 Programmer I Study Guide
this week in the
Web Component Certification (SCWCD/OCPJWCD)
Joined: Sep 17, 2004
Oct 01, 2006 10:24:00
What is the difference between a RequestDispatcher object obtained from the Request object and the RequestDispatcher object obtained from the ServletContext ?
SCWCD 1.4, SCJP 1.4
Joined: Aug 24, 2005
Oct 01, 2006 11:35:00
The ServletRequest.getRequestDispatcher() method can accept paths relative to the current request (paths that don't start with a slash).
Paths passed to the ServletContext.getRequestDispatcher() method must start with a slash (and are therefore relative to the web app root.)
Joined: Mar 20, 2005
Oct 01, 2006 11:40:00
You MUST use context relative URLs with the one from the ServletContext (beginning with /), while you MAY use a URL relative to the current
(ommitting the /) as well as context relative with that from ServletRequest.
I agree. Here's the link:
What is the diff between a RequestDispatcher object obtained from Request & Context
Guidelines for Servlet Design?
A question on RequestDispatcher
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015