Hi all!

If you have a HttpServletRequest req,

you can get 

String contextPath = req.getContextPath();

This would give you "/myapp".

My question is: How can I get to know the context path in 
init(), where I don't have a HttpServletRequest?

> have you tried using getServletContext() or
> getServletContextName()....
> 
I have the impression this works only if you have a context 
specified in server.xml.

Andreas

> Regards
> Prashanth
> 
> 
> --- Ashish Kulkarni <[EMAIL PROTECTED]> wrote:
> > Hi,
> > Sorry for asking a very basic question, but i need
> > to
> > know the answer
> > Suppose i have a URL like below
> > http://localhost:8080/myapp/index.jsp
> > 
> > how can i find in servlet or jsp what is the
> > application name
> > like in the above case it is myapp, 
> > suppose there is other URL 
> > http://localhost:8080/myapp1/index.jsp
> > how can i get value of myapp1 (it can be any
> > thing)in
> > my jsp or servlet
> > Ashish
> > 
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! News - Today's headlines
> > http://news.yahoo.com
> > 
> > --
> > To unsubscribe, e-mail:  
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > 
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! News - Today's headlines
> http://news.yahoo.com
> 
> --
> To unsubscribe, e-mail:  
> <mailto:[EMAIL PROTECTED]> For
> additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to