The ServletContextListener interface has a callback method  -
contextInitialized() - that passes in a ServletContextEvent parameter. You
can get the context from getServletContext() method of ServletContextEvent.

This was added in Servlet 2.3 spec.

Steve

> -----Original Message-----
> From: Jing Zhou [mailto:[EMAIL PROTECTED]
> Sent: July 30, 2003 11:18 PM
> To: Struts Users Mailing List
> Subject: Could one figure out the context path in Servlet.init() method?
>
>
> Hi,
>
> Maybe I overlook something. We can get context path
> from HttpServletRequest.getContextPath() at request time.
> But could one get the same path when the servlet is
> initialized? Or simply say why we do not have an API like
> ServletContext.getContextPath()?
>
> Jing
> Netspread Carrier
> http://www.netspread.com
>



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

Reply via email to