You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Raghuveer <ra...@infotechsw.com> on 2008/04/02 18:03:35 UTC
application folder name in webapps folder in tomcat.
I have HelloServlet ,HelloServletContextListener in 3 different applications
in tomcat
<tomcat_home>webapps\AppHello1
<tomcat_home>webapps\AppHello2
<tomcat_home>webapps\AppHello3
How to identify in my listner class what is the folder/context name in my
server.
public void contextInitialized(ServletContextEvent ce) {
contextName = ce.getServletContext().getServletContextName();
}
This code is working only if i have
<display-name>AppHello1</display-name> in web.xml.
If there is no <display-name> in web.xml then above code in listner class is
returning null.
Is there facility to know application folder name in webapps folder in
tomcat.
Re: application folder name in webapps folder in tomcat.
Posted by Laurie Harper <la...@holoweb.net>.
Raghuveer wrote:
>
>
> I have HelloServlet ,HelloServletContextListener in 3 different applications
> in tomcat
>
> <tomcat_home>webapps\AppHello1
> <tomcat_home>webapps\AppHello2
> <tomcat_home>webapps\AppHello3
>
> How to identify in my listner class what is the folder/context name in my
> server.
>
> public void contextInitialized(ServletContextEvent ce) {
> contextName = ce.getServletContext().getServletContextName();
> }
>
>
> This code is working only if i have
> <display-name>AppHello1</display-name> in web.xml.
> If there is no <display-name> in web.xml then above code in listner class is
> returning null.
>
> Is there facility to know application folder name in webapps folder in
> tomcat.
Call getRealPath("/") on the servlet context:
http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/ServletContext.html#getRealPath(java.lang.String)
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org