Unfortunately, there is no means within the init() method of a servlet to
determine the context path of this web application (i.e. the
'/APPLE" part of a complete request URI).  You won't know that until the
first request comes in.

Craig McClanahan


 On Mon, 6 Aug 2001, Diu Lee Lo Mo wrote:

> 
> Dear all,
> 
>   I would like to ask how to get the web virtual path
> of a specified project in tomcat. 
>  
>   E.g. I got a project APPLE which are placed all
> source in /webapp/APPLE. 
> 
>   By default, this project can be accessed by
> Http://localhost:8080/APPLE/
> 
>   Assume I am running a servlet called 'EAT.class' ,
> then the path should be something like that
> Http://localhost:8080/APPLE/servlet/EAT .
> 
>   How can EAT.class know this path when running INIT()
> function ?
> 
>   I know that we can get some parameters from web.xml
> by using getInitParameter() function. I also know that
> we can get the virtual path by using
> request.getRequestURI() inside doPost()/doGet()
> function. But I don't know how to get it inside INIT()
> function. 
> 
>   Thank you for your help! 
>   
> M.T.
> ==================================================================
> �s���K�O�q�l�H�c  http://sinamail.sina.com.hk
> 
> 
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
> 

Reply via email to