| <?xml version="1.0" encoding="utf-8"?> | |
| <!--Arbortext, Inc., 1988-2005, v.4002--> | |
| <!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" | |
| "concept.dtd"> | |
| <concept id="ccwebprj" xml:lang="en-us"> | |
| <title>Dynamic Web projects and applications</title> | |
| <prolog><metadata> | |
| <keywords><indexterm>enterprise applications<indexterm>projects<indexterm>dynamic Web projects</indexterm></indexterm></indexterm> | |
| <indexterm>Web projects<indexterm>dynamic projects overview</indexterm></indexterm> | |
| </keywords> | |
| </metadata></prolog> | |
| <conbody> | |
| <p>There are two types of Web projects: dynamic and <xref href="ccstatic.dita" | |
| scope="peer"><desc></desc>static</xref>. Dynamic web projects can contain | |
| dynamic J2EE resources such as servlets, JSP files, filters, and associated | |
| metadata, in addition to static resources such as images and HTML files. Static | |
| web projects only contains static resources. When you create Web projects, | |
| you can include cascading style sheets and JSP tag libraries (for dynamic | |
| Web projects), so that you can begin development with a richer set of project | |
| resources.</p> | |
| <p>Dynamic Web projects are always imbedded in Enterprise Application projects. | |
| The wizard that you use to create a dynamic Web project will also create an | |
| Enterprise Application (EAR) project if it does not already exist. The wizard | |
| will also update the <filepath>application.xml</filepath> deployment descriptor | |
| of the specified Enterprise Application project to define the Web project | |
| as a module element. If you are importing a WAR file rather than creating | |
| a dynamic Web project new, the WAR Import wizard requires that you specify | |
| a Web project, which already requires an EAR project. </p> | |
| <p>J2EE conventions may represent extra overhead if you only want to create | |
| a static, content-based Web application, which contains no dynamic files, | |
| such as JSP files or servlets. In this case, when you need only the most basic | |
| Web project, you might want to use the <i>static</i> Web project type (see <xref | |
| href="ccstatic.dita" scope="peer"><desc></desc>Static Web projects</xref>). | |
| Note that static Web projects can be converted to dynamic Web projects by | |
| selecting <b>Convert to a Dynamic Web Project</b>, from the Project menu.</p> | |
| <p>The J2EE model, and more specifically, the <cite>Sun Microsystems <tm tmclass="special" | |
| tmowner="Sun Microsystems, Inc." tmtype="tm" trademark="Java">Java</tm> Servlet | |
| 2.3 Specification</cite>, defines a Web application directory structure that | |
| specifies the location of Web content files, class files, class paths, deployment | |
| descriptors, and supporting metadata. The Web project hierarchy mirrors that | |
| of the Web application created from a project. In the workbench, you can use | |
| the <ph>New Web Project</ph> wizard to create a new Web project.</p> | |
| <p>The main project folder contains all development objects related to a Web | |
| application. The Web content folder contains the elements of the project necessary | |
| to create a Web application. This folder structure maps to the Web application | |
| archive (WAR) structure defined by Sun Microsystems.. The following default | |
| elements are located in the Web project folder hierarchy: <note>In the Project | |
| Explorer view, Web projects are filtered into folder nodes to customize the | |
| display of Web resources for easy management during development. For information | |
| on the filtered structure, see <xref href="ccwebvw.dita" scope="peer"><desc></desc>Project | |
| Explorer view</xref>.</note><dl><dlentry> | |
| <dt>Web Deployment Descriptor</dt> | |
| <dd>The standard Web application deployment descriptor (the <filepath>web.xml</filepath> file).</dd> | |
| </dlentry><dlentry> | |
| <dt>JavaSource</dt> | |
| <dd>Contains the project's <tm tmclass="special" tmowner="Sun Microsystems, Inc." | |
| tmtype="tm" trademark="Java">Java</tm> source code for classes, beans, and | |
| servlets. When these resources are added to a Web project, they are automatically | |
| compiled and the generated files are added to the WEB-INF/classes directory. | |
| The contents of the source directory are not packaged in WAR files unless | |
| an option is specified when a WAR file is created. <note>Though the default | |
| name given to the folder is JavaSources, you can change the name by right | |
| clicking on the name in the Project Explorer and clicking on <menucascade> | |
| <uicontrol>Refactor</uicontrol><uicontrol>Rename</uicontrol></menucascade>.</note></dd> | |
| </dlentry><dlentry> | |
| <dt>imported_classes folder</dt> | |
| <dd>This folder may be created during a WAR import, and contains class files | |
| that do not have accompanying source. The <uicontrol>imported_classes</uicontrol> folder | |
| is a <tm tmclass="special" tmowner="Sun Microsystems, Inc." tmtype="tm" trademark="Java">Java</tm> classes | |
| folder; <tm tmclass="special" tmowner="Sun Microsystems, Inc." tmtype="tm" | |
| trademark="Java">Java</tm> classes folders can also be created using the Web | |
| project <uicontrol>Java Build Path</uicontrol> properties page.</dd> | |
| </dlentry><dlentry> | |
| <dt>WebContent folder</dt> | |
| <dd>The mandatory location of all Web resources, including HTML, JSP, graphic | |
| files, and so on. If the files are not placed in this directory (or in a subdirectory | |
| structure under this directory), the files will not be available when the | |
| application is executed on a server. The Web content folder represents the | |
| contents of the WAR file that will be deployed to the server. Any files not | |
| under the Web content folder are considered development-time resources (for | |
| example, .java files, .sql files, and .mif files), and are not deployed when | |
| the project is unit tested or published. <note>Though the default name given | |
| to the folder is <filepath>WebContent</filepath>, you can change the name | |
| in the Project Explorer by right-clicking the folder and selecting <uicontrol>Refactor</uicontrol><uicontrol>Rename</uicontrol> or | |
| from the Web page of the project's Properties dialog. In a dynamic Web project, | |
| changing the folder name will update the <tm tmclass="special" tmowner="Sun Microsystems, Inc." | |
| tmtype="tm" trademark="Java">Java</tm> build output directory. </note></dd> | |
| </dlentry><dlentry> | |
| <dt>META-INF</dt> | |
| <dd>This directory contains the <filepath>MANIFEST.MF</filepath> file, which | |
| is used to map class paths for dependent JAR files that exist in other projects | |
| in the same Enterprise Application project. An entry in this file will update | |
| the run-time project class path and <tm tmclass="special" tmowner="Sun Microsystems, Inc." | |
| tmtype="tm" trademark="Java">Java</tm> build settings to include the referenced | |
| JAR files.</dd> | |
| </dlentry><dlentry> | |
| <dt>theme</dt> | |
| <dd>The suggested directory for cascading style sheets and other style-related | |
| objects.</dd> | |
| </dlentry><dlentry> | |
| <dt>WEB-INF</dt> | |
| <dd>Based on the <cite>Sun Microsystems <tm tmclass="special" tmowner="Sun Microsystems, Inc." | |
| tmtype="tm" trademark="Java">Java</tm> Servlet 2.3 Specification</cite>, this | |
| directory contains the supporting Web resources for a Web application, including | |
| the <filepath>web.xml</filepath> file and the classes and lib directories.</dd> | |
| </dlentry><dlentry> | |
| <dt>/classes</dt> | |
| <dd>This directory is for servlets, utility classes, and the <tm tmclass="special" | |
| tmowner="Sun Microsystems, Inc." tmtype="tm" trademark="Java">Java</tm> compiler | |
| output directory. The classes in this directory are used by the application | |
| class loader to load the classes. Folders in this directory will map package | |
| and class names, as in: <codeph>/WEB-INF/classes/com/mycorp/servlets/MyServlet.class</codeph>.<p>Do | |
| not place any .class files directly into this directory. The .class files | |
| are placed in this directory automatically when the <tm tmclass="special" | |
| tmowner="Sun Microsystems, Inc." tmtype="tm" trademark="Java">Java</tm> compiler | |
| compiles <tm tmclass="special" tmowner="Sun Microsystems, Inc." tmtype="tm" | |
| trademark="Java">Java</tm> source files that are in the <filepath>Java Resources</filepath> directory. | |
| Any files placed directly in this directory will be deleted by the <tm tmclass="special" | |
| tmowner="Sun Microsystems, Inc." tmtype="tm" trademark="Java">Java</tm> compiler | |
| when it runs.</p></dd> | |
| </dlentry><dlentry> | |
| <dt>/lib</dt> | |
| <dd>The supporting JAR files that your Web application references. Any classes | |
| in .jar files placed in this directory will be available for your Web application</dd> | |
| </dlentry><dlentry> | |
| <dt>Libraries</dt> | |
| <dd>The supporting JAR files that your Web application references. This folder | |
| mirrors the content of the lib folder. In addition, Web Library Projects, | |
| which are "virtual" JAR files that do not physically reside in the Web project, | |
| but are associated with <tm tmclass="special" tmowner="Sun Microsystems, Inc." | |
| tmtype="tm" trademark="Java">Java</tm> projects elsewhere in your workspace, | |
| are included in this folder. They are packaged with your project when you | |
| export the application's WAR file.</dd> | |
| </dlentry></dl> <note>A library entry on the <tm tmclass="special" tmowner="Sun Microsystems, Inc." | |
| tmtype="tm" trademark="Java">Java</tm> build path will remain there unless | |
| the actual JAR file is deleted from the WEB-INF/lib folder. If you remove | |
| a library path entry but not the JAR file, the library entry will be re-added | |
| to the path automatically.</note></p> | |
| </conbody> | |
| </concept> |