Context Root determines that Tomcat forwards those URL requests to the Web App. If the app's context root is set to MyApp, unless there is a more explicit context root Web app, all/myapp or/myapp/* requests will be forwarded to your app for processing. If the second application context root is set to Myapp/help, then/myapp/help/help.jsp's request will be forwarded to the second application for processing instead of the first application.
The same relationship applies to the context root, which is called root context. When the application is designated as root context, it responds to all requests that are not processed by the explicit context root.
The context root of your app depends on how your app is deployed. If the Web app is deployed as part of the ear package, then context root is set through the Web module context-root element in the Application.xml file in the ear package. In the following example, the context root of the Web-client.war application is set to the bank.
<application xmlns= "HTTP://JAVA.SUN.COM/XML/NS/J2EE" version= "1.4"
Http://java.sun.com/xml/ns/j2ee/application_1_4.xsd ">
<display-name>JBossDukesBank</display-name>
<module>
<ejb>bank-ejb.jar</ejb>
</module>
<module>
<web>
<web-uri>web-client.war</web-uri>
<context-root>bank</context-root>
</web>
</module>
</application>
For web apps that are deployed outside the EAR file, you can specify the context root in two ways. The first method is specified in the Web-inf/jboss-web.xml file. The following example shows a Jboss-web.xml file for a Web application that is deployed outside the ear file.
<jboss-web>
<context-root>bank</context-root>
</jboss-web>
Finally, if you do not specify a context root, the Web app uses the file name of the WAR file as the context root. For Web-client.war, the context root will be set to Web-client by default. The only exception is the special name ROOT. To deploy the root context Web app, you only need to name it Root.war, but JBoss already contains root.war in the Jbossweb-tomcat55.sar directory. So you need to remove or rename the Root.war that comes with JBoss.
Using the context root as the name of the war file is a good practice, which not only reduces the number of configuration settings that are managed, but also makes the Web application more specific, thereby improving maintainability.