tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xeth Waxman <xwax...@gmail.com>
Subject Re: Traversing up a directory using RequestDispatcher
Date Fri, 17 Sep 2004 15:24:33 GMT
OK, so apparently I am doing a cross context request dispatcher call,
which is bad.  So I shouldn't do that.  Assuming my app is under
c:\jakarta\webapps\ChargeCard (context is /ChargeCard), that means my
servlets should be under
c:\jakarta\webapps\ChargeCard\WEB-INF\classes, correct?  If that is
the case, how do I get my pages to invoke my servlets?  To date I have
been putting my servlets in c:\jakarta\webapps\ROOT\WEB-INF\classes,
and invoking them with /servlet/com.gcc.creditcard.DoLogin.  Now that
my classes are under /ChargeCard, invoking them with
/servlet/com.gcc.creditcard.DoLogin says that they're not found, and
likewise with just com.gcc.creditcard/DoLogin.  I'm sure their's a
very simple answer found somewhere I just don't know where to look, so
if you feel like making me work to get the answer feel free to just
point out the resource I should be viewing (I can't find anything in
the tomcat docs).

Thanks!

--Xeth


On Fri, 17 Sep 2004 08:17:07 -0400, Shapira, Yoav <yoav.shapira@mpi.com> wrote:
> 
> Hi,
> First of all, Xeth is the best name I've seen in a long time -- cool!
> 
> 
> 
> >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!
> 
> The RequestDispatcher's behavior is constrained by the Servlet
> Specification.  Its JavaDoc has an explanation on how it resolves
> relative links: the leading slash for the getRequestDispatcher call is
> not really absolute, it's relative to the webapp's docBase.
> 
> There's no reason Tomcat would use ROOT as the docBase, unless you're
> actually in the root webapp.  What is the docBase for your webapp?
> (Hint: it's not c:\jakarta-tomcat-5.0.12\webapps, it's a subdirectory
> under it, unless you've explicitly defined a Context with the webapp
> docBase) (in which case, if you kept the default Host appBase, you have
> a bad configuration).
> 
> Yoav
> 
> This e-mail, including any attachments, is a confidential business communication, and
may contain information that is confidential, proprietary and/or privileged.  This e-mail
is intended only for the individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the sender.  Thank you.
> 
> 



-- 
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


Mime
View raw message