DefaultWebApp DefaultWebAppWEB-INFweb.xml DefaultWebAppWEB-INFweblogic.xml DefaultWebAppWEB-INFclasses DefaultWebAppWEB-INFlib Accessing Information in WEB-INF

3-2 Developing Web Applications, Servlets, and JSPs for Oracle WebLogic Server application as part of an enterprise application. This is an Oracle best practice, which allows for easier application migration, additions, and changes. Also, packaging your Web application as part of an enterprise application allows you to take advantage of the split development directory structure, which provides a number of benefits over the traditional single directory structure. The WEB-INF directory contains the deployment descriptors for the Web application web.xml and weblogic.xml and two subdirectories for storing compiled Java classes and library JAR files. These subdirectories are respectively named classes and lib. JSP taglibs are stored in the WEB-INF directory at the top level of the staging directory. The Java classes include servlets, helper classes and, if desired, precompiled JSPs. All servlets, classes, static files, and other resources belonging to a Web application are organized under a directory hierarchy. The entire directory, once staged, is bundled into a WAR file using the jar command. The WAR file can be deployed alone or as part of an enterprise application recommended with other application components, including other Web applications, EJB components, and WebLogic Server components. JSP pages and HTTP servlets can access all services and APIs available in WebLogic Server. These services include EJBs, database connections through Java Database Connectivity JDBC, JavaMessaging Service JMS, XML, and more.

3.2.1 DefaultWebApp

Place your static files, such as HTML files and JSP files in the directory that is the document root of your Web application. In the default installation of WebLogic Server, this directory is called DefaultWebApp, under user_ domainsmydomainapplications. To make your Web application the default Web application, you must set context-root to in the weblogic.xml deployment descriptor file.

3.2.2 DefaultWebAppWEB-INFweb.xml

The DefaultWebAppWEB-INFweb.xml file is the Web application deployment descriptor that configures the Web application.

3.2.3 DefaultWebAppWEB-INFweblogic.xml

The DefaultWebAppWEB-INFweblogic.xml file is the WebLogic-specific deployment descriptor file that defines how named resources in the web.xml file are mapped to resources residing elsewhere in WebLogic Server. This file is also used to define JSP and HTTP session attributes.

3.2.4 DefaultWebAppWEB-INFclasses

The DefaultWebAppWEB-INFclasses directory contains server-side classes such as HTTP servlets and utility classes.

3.2.5 DefaultWebAppWEB-INFlib

The DefaultWebAppWEB-INFlib directory contains JAR files used by the Web application, including JSP tag libraries. Creating and Configuring Web Applications 3-3

3.2.6 Accessing Information in WEB-INF

The WEB-INF directory is not part of the public document tree of the application. No file contained in the WEB-INF directory can be served directly to a client by the container. However, the contents of the WEB-INF directory are visible to servlet code using the getResource and getResourceAsStream method calls on the ServletContext or includesforwards using the RequestDispatcher. Hence, if the application developer needs access, from servlet code, to application specific configuration information that should not be exposed directly to the Web client, the application developer may place it under this directory. Since requests are matched to resource mappings in a case-sensitive manner, client requests for WEB-INFfoo, WEb-iNffoo, for example, should not result in contents of the Web application located under WEB-INF being returned, nor any form of directory listing thereof.

3.2.7 Directory Structure Example