Hi Andy!

Just a fine point here.

A Yang wrote:
> RequestDispatch.forward takes a URL that is a RELATIVE
> path but also requires a leading slash.

>From the javadoc of ServletRequest.getRequestDispatcher(String):

'The pathname specified may be relative, although it cannot extend
outside the current servlet context. If the path begins with a "/" it is
interpreted as relative to the current context root. This method returns
null if the servlet container cannot return a RequestDispatcher.

The difference between this method and
ServletContext.getRequestDispatcher(String) is that this method can take
a relative path.'

So, if you get your RequestDispatcher from the request, you don't need
the leading "/".

Un saludo,

Alex.

Reply via email to