You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Xeth Waxman <xw...@gmail.com> on 2004/09/17 01:51:27 UTC
Traversing up a directory using RequestDispatcher
I have a bizarre issue. Using Tomcat 5.0.12, I have an application in
the directory C:\jakarta-tomcat-5.0.12\webapps called ChargeCard.
After loggin in, I am trying to forward a request to jsp page in that
directory. However, RequestDispatcher apparently uses the directory
C:\jakarta-tomcat-5.0.12\webapps\ROOT as the Document root, so I need
to go up a directory in my forward request (something like url =
"../ChargeCard/index.jsp";) However, RequestDispatcher requires a /
to start off the url, so I can't use the ../ start to go up a
directory. Does anyone have an idea how I would do this? I tried url
= "/../ChargeCard/index.jsp";, but that results in a
NullPointerException being thrown. All help is appreciated!
--
Xeth Waxman
xwaxman@gmail.com
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Traversing up a directory using RequestDispatcher
Posted by John Villar <jo...@florhard.com>.
if you're forwarding from the "ChargeCard" directory, you just have to
include only the name of the page in the forward directive (e.g.
"something.jsp" or "./something.jsp").... the trailing backslash is
directly referring the root context of "this" host
John Villar
Gerente de Proyectos
Computadores Flor Hard Soft 2058 C.A.
www.florhard.com
Xeth Waxman escribió:
>I have a bizarre issue. Using Tomcat 5.0.12, I have an application in
>the directory C:\jakarta-tomcat-5.0.12\webapps called ChargeCard.
>After loggin in, I am trying to forward a request to jsp page in that
>directory. However, RequestDispatcher apparently uses the directory
>C:\jakarta-tomcat-5.0.12\webapps\ROOT as the Document root, so I need
>to go up a directory in my forward request (something like url =
>"../ChargeCard/index.jsp";) However, RequestDispatcher requires a /
>to start off the url, so I can't use the ../ start to go up a
>directory. Does anyone have an idea how I would do this? I tried url
>= "/../ChargeCard/index.jsp";, but that results in a
>NullPointerException being thrown. All help is appreciated!
>
>