Re[3]: How to get context root of a web application
Posted By:
Christopher_Koenigsberg
Posted On:
Sunday, March 5, 2006 12:08 AM
There is a ServletContext.getServletContextName() I think (look it up). It will return the value that your web.xml has in the "display-name" (I think; look it up to be sure). I don't think this is guaranteed in the J2EE specs but it works on WebSphere, WebLogic, Tomcat, and JBoss...
If you make sure this is the same as your context root, you can use it, as long as you can get a ServletContext.