📄 webapp4.html
字号:
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <title>Web Modules</title> <link rel="StyleSheet" href="document.css" type="text/css" media="all" /> <link rel="StyleSheet" href="catalog.css" type="text/css" media="all" /> <link rel="Table of Contents" href="J2EETutorialTOC.html" /> <link rel="Previous" href="WebApp3.html" /> <link rel="Next" href="WebApp5.html" /> <link rel="Index" href="J2EETutorialIX.html" /> </head> <body> <table width="550" summary="layout" id="SummaryNotReq1"> <tr> <td align="left" valign="center"> <font size="-1"> <a href="http://java.sun.com/j2ee/1.4/download.html#tutorial" target="_blank">Download</a> <br> <a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/faq.html" target="_blank">FAQ</a> <br> <a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/history.html" target="_blank">History</a> </td> <td align="center" valign="center"><a accesskey="p" href="WebApp3.html"><img id="LongDescNotReq1" src="images/PrevArrow.gif" width="26" height="26" border="0" alt="Prev" /></a><a accesskey="c" href="J2EETutorialFront.html"><img id="LongDescNotReq1" src="images/UpArrow.gif" width="26" height="26" border="0" alt="Home" /></a><a accesskey="n" href="WebApp5.html"><img id="LongDescNotReq3" src="images/NextArrow.gif" width="26" height="26" border="0" alt="Next" /></a><a accesskey="i" href="J2EETutorialIX.html"></a> </td> <td align="right" valign="center"> <font size="-1"> <a href="http://java.sun.com/j2ee/1.4/docs/api/index.html" target="_blank">API</a> <br> <a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/search.html" target="_blank">Search</a> <br> <a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/sendusmail.html" target="_blank">Feedback</a></font> </font> </td> </tr> </table> <img src="images/blueline.gif" width="550" height="8" ALIGN="BOTTOM" NATURALSIZEFLAG="3" ALT="Divider"> <blockquote><a name="wp64585"> </a><h2 class="pHeading1">Web Modules</h2><a name="wp79054"> </a><p class="pBody">In the J2EE architecture, Web components and static Web content files such as images are called <em class="cEmphasis">Web resources</em>. A <em class="cEmphasis">Web module</em> is the smallest deployable and usable unit of Web resources. A J2EE Web module corresponds to a <em class="cEmphasis">Web application</em> as defined in the Java Servlet Specification. </p><a name="wp79064"> </a><p class="pBody">In addition to Web components and Web resources, a Web module can contain other files including:</p><div class="pSmartList1"><ul class="pSmartList1"><a name="wp79065"> </a><div class="pSmartList1"><li>Server-side utility classes (database beans, shopping carts, and so on). Often these classes conform to the JavaBeans component architecture.</li></div><a name="wp79068"> </a><div class="pSmartList1"><li>Client-side classes (applets and utility classes).</li></div></ul></div><a name="wp79033"> </a><p class="pBody">A Web module has a specific structure. The top-level directory of a Web module is the <em class="cEmphasis">document root</em> of the application. The document root is where JSP pages, <em class="cEmphasis">client-side </em>classes and archives, and static Web resources, such as images, are stored. </p><a name="wp79034"> </a><p class="pBody">The document root contains a subdirectory named <code class="cCode">/WEB-INF/</code>, which contains the following files and directories:</p><div class="pSmartList1"><ul class="pSmartList1"><a name="wp79035"> </a><div class="pSmartList1"><li><code class="cCode">web.xml</code>--The Web application deployment descriptor</li></div><a name="wp79039"> </a><div class="pSmartList1"><li>Tag library descriptor files (see <a href="JSPTags6.html#wp90086">Tag Library Descriptors</a>)</li></div><a name="wp79040"> </a><div class="pSmartList1"><li><code class="cCode">classes</code>--A directory that contains <em class="cEmphasis">server-side classes</em>: servlets, utility classes, and JavaBeans components</li></div><a name="wp138310"> </a><div class="pSmartList1"><li><code class="cCode">tags</code>--A directory that contains tag files, which are implementations of tag libraries (see <a href="JSPTags5.html#wp89709">Tag File Location</a>)</li></div><a name="wp79041"> </a><div class="pSmartList1"><li><code class="cCode">lib</code>--A directory that contains JAR archives of libraries called by server-side classes</li></div></ul></div><a name="wp79042"> </a><p class="pBody">You can also create application-specific subdirectories (that is, package directories) in either the document root or the <code class="cCode">/WEB-INF/classes/</code> directory.</p><a name="wp184737"> </a><p class="pBody">A Web module can be deployed as an unpacked file structure or packaged in a JAR file known as a Web archive (WAR) file. Since the contents and use of WAR files differ from JAR files, WAR file names use a <code class="cCode">.war</code> extension. The Web module just described is portable; you can deploy it into any Web container that conforms to the Java Servlet Specification.</p><a name="wp213968"> </a><p class="pBody">In order to deploy a WAR on the J2EE 1.4 Application Server, it must also contain a runtime deployment descriptor. The runtime deployment descriptor is an XML file that contains information such as the context root, the JNDI names of the application's resources, and some J2EE 1.4 Application Server implementation-specific parameters. The J2EE Application Server Web application runtime deployment descriptor is named <code class="cCode">sun-web_app.xml</code> and is located in /<code class="cCode">WEB-INF/</code> along with the Web application deployment descriptor. The structure of a Web module that can be deployed on the J2EE 1.4 Application Server is shown in <a href="WebApp4.html#wp213981">Figure 3-3</a>.</p><a name="wp213979"> </a><p class="pBody"></p><div align="left"><img src="images/web-structure3.gif" height="297" width="374" alt="Web Module Structure" border="0" hspace="0" vspace="0"/></div><p class="pBody"></p><p> <a name="213981"> </a><strong><font >Figure 3-3 Web Module Structure</font></strong></p> </blockquote> <img src="images/blueline.gif" width="550" height="8" ALIGN="BOTTOM" NATURALSIZEFLAG="3" ALT="Divider"> <table width="550" summary="layout" id="SummaryNotReq1"> <tr> <td align="left" valign="center"> <font size="-1"> <a href="http://java.sun.com/j2ee/1.4/download.html#tutorial" target="_blank">Download</a> <br> <a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/faq.html" target="_blank">FAQ</a> <br> <a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/history.html" target="_blank">History</a> </td> <td align="center" valign="center"><a accesskey="p" href="WebApp3.html"><img id="LongDescNotReq1" src="images/PrevArrow.gif" width="26" height="26" border="0" alt="Prev" /></a><a accesskey="c" href="J2EETutorialFront.html"><img id="LongDescNotReq1" src="images/UpArrow.gif" width="26" height="26" border="0" alt="Home" /></a><a accesskey="n" href="WebApp5.html"><img id="LongDescNotReq3" src="images/NextArrow.gif" width="26" height="26" border="0" alt="Next" /></a><a accesskey="i" href="J2EETutorialIX.html"></a> </td> <td align="right" valign="center"> <font size="-1"> <a href="http://java.sun.com/j2ee/1.4/docs/api/index.html" target="_blank">API</a> <br> <a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/search.html" target="_blank">Search</a> <br> <a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/sendusmail.html" target="_blank">Feedback</a></font> </font> </td> </tr> </table> <img src="images/blueline.gif" width="550" height="8" ALIGN="BOTTOM" NATURALSIZEFLAG="3" ALT="Divider"><p><font size="-1">All of the material in <em>The J2EE(TM) 1.4 Tutorial</em> is <a href="J2EETutorialFront2.html">copyright</a>-protected and may not be published in other workswithout express written permission from Sun Microsystems.</font> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -