Chapter 7: Web Application Confi guration located in a directory called exampleapp, and can be accessed by the URL http://localhost:8080/ exampleapp/. Here, /exampleapp/is called the context path for the Web application. The context path refers to everything in the URL after the server and port number, and is the part of the URL that is used to resolve the location of the resource. webapps/ exampleapp/ index.jspcontact.htmlimages/ META-INF/ WEB-INF/ photo.jpg graphic.png web.xml classes/ SampleServlet.class lib/ struts.jar tags/ Figure 7-1: Directory structure for a sample Web application An exception to this is the ROOT Web application, which is installed under /webapps/ ROOT. No context path needs to be specified for the ROOT Web application, as shown in the following URL: http://localhost:8080/ In terms of the structure of the Web application, the minimum that is required is a WEB-INFdirectory with a web.xml file in it. As discussed previously in Chapter 2 , HTML and JSP pages belong to the public resources that a client may request directly. All the contents of the WEB-INFand META-INFdirectories fall into the category of an application s private resources, and cannot be accessed directly by client applications. Public Resources Everything outside the WEB-INFand META-INF directories are public resources, and can be accessed via an appropriate URL. For example, the contact.htmlfile can be accessed as follows: http://localhost:8080/exampleapp/contact.html The placement of publicly accessible files (such as JSP and HTML pages, CSS, and images) is arbitrary as far as the specifications for Web applications are concerned, and they can be accessed directly by a client.
For high quality website hosting services please check java web hosting website.
This entry was posted
on Friday, March 27th, 2009 at 2:17 pm and is filed under tomcat.
You can follow any responses to this entry through the RSS 2.0 feed.
Responses are currently closed, but you can trackback from your own site.