0 Replies Latest reply on Jun 23, 2004 3:47 AM by erikengerd2

    ServletRequest.getRequestDispatcher()/relative path question

    erikengerd2 Newbie


      I have a web application with context root /ServletTest.
      The servlet-mapping for one servlet in the application is


      In my web application there is a file called file.html in the web root.

      Now, this servlet forward every request. It forwards it to "file.html" using a relative path as follows:

      RequestDispatcher dispatcher = request.getRequestDispatcher("file.html");
      dispatcher.forward(request, response);

      Now when I open the URL http://:/ServletTest/HelloWorldServlet/abc.html,
      the browser shows the file file.html. In other words, it has forwarded to

      Isn't this behavior wrong? As I understand it, the request should be relative to the servlet path so it should have tried to forward to http://:/ServletTest/HelloWorldServlet/file.html instead.

      Is the behavior of JBoss correct (JBoss v. 3.2.3)?