Could someone please define the term "relative" url with respect to pageContext.forward() or pageContext.include() or the errorPage directive?

Brad Cox

To answer my own question, relative url means the absolute url minus the servlet context name, and it must always begin with a '/'. It does not mean relative to the file that issues the request in spite of what those familiar with html might expect.

The 3.1 release of Tomcat exacerbates the confusion by providing a getRequestDispatcher(url) method that returns a null if the url does not begin with a '/', triggering NullPointerExceptions deep within Tomcat. The 3.2 release fixed this by providing a new version that will remove the context name if provided. Neither version supports "real" relative urls, e.g. urls that begin with ../ as in html files.

Those who've grown as weary as I of JSP pecularities and Tomcat bugs should take a look at <a href="", which describes a simple Java preprocessor that eliminates the need for JSP once and for all.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact