📄 webapp5.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>Packaging 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="WebApp4.html" /> <link rel="Next" href="WebApp6.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="WebApp4.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="WebApp6.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="wp115753"> </a><h2 class="pHeading1">Packaging Web Modules</h2><a name="wp115755"> </a><p class="pBody">A Web module must be packaged into a WAR in certain deployment scenarios and whenever you want to distribute the Web module. You package a Web module into a WAR using the J2EE 1.4 Application Server <code class="cCode">deploytool</code> utility. To build and package the <code class="cCode">hello1</code> application into a WAR named <code class="cCode">hello1.war</code>: </p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp83946"> </a><div class="pSmartList1"><li>In a terminal window, go to <code class="cCode"><</code><code class="cVariable">INSTALL</code><code class="cCode">>/j2eetutorial14/examples/web/hello1/</code>.</li></div><a name="wp83947"> </a><div class="pSmartList1"><li>Run <code class="cCode">asant</code> <code class="cCode">build</code>. This target will spawn any necessary compilations and copy files to the <code class="cCode"><</code><code class="cVariable">INSTALL</code><code class="cCode">>/j2eetutorial14/examples/web/hello1/build/</code> directory.</li></div><a name="wp214130"> </a><div class="pSmartList1"><li>Start <code class="cCode">deploytool</code>.</li></div><a name="wp214131"> </a><div class="pSmartList1"><li>Create a Web application called <code class="cCode">hello1</code> by running the New Web Component Wizard. Select File<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>New<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Web Component.</li></div><a name="wp214132"> </a><div class="pSmartList1"><li>New Web Component Wizard</li></div><div class="pSmartList2"><ol type="a" class="pSmartList2"><a name="wp214133"> </a><div class="pSmartList2"><li>Select the Create New Stand-Alone WAR Module radio button.</li></div><a name="wp214134"> </a><div class="pSmartList2"><li>In the WAR Location field, enter <code class="cCode"><</code><code class="cVariable">INSTALL</code><code class="cCode">>/j2eetutorial14/examples/web/hello1/hello1.war</code>. </li></div><a name="wp214135"> </a><div class="pSmartList2"><li>In the WAR Name field enter <code class="cCode">hello1</code>.</li></div><a name="wp214136"> </a><div class="pSmartList2"><li>Click Edit to add the content files.</li></div><a name="wp214137"> </a><div class="pSmartList2"><li>In the Edit Contents dialog, navigate to <code class="cCode"><</code><code class="cVariable">INSTALL</code><code class="cCode">>/j2eetutorial14/examples/web/hello1/build/</code>. Select <code class="cCode">duke.waving.gif</code>, <code class="cCode">index.jsp</code>, and <code class="cCode">response.jsp</code> and click Add. Click OK.</li></div><a name="wp214138"> </a><div class="pSmartList2"><li>Click Next.</li></div><a name="wp214139"> </a><div class="pSmartList2"><li>Select the JSP radio button. </li></div><a name="wp217431"> </a><div class="pSmartList2"><li>Select /index.jsp in the JSP Filename combo box.</li></div><a name="wp214140"> </a><div class="pSmartList2"><li>Click Finish.</li></div></ol></div><a name="wp214141"> </a><div class="pSmartList1"><li>Select File<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Save.</li></div></ol></div><a name="wp214190"> </a><p class="pBody">A sample <code class="cCode">hello1.war</code> is provided in <code class="cCode"><</code><code class="cVariable">INSTALL</code><code class="cCode">>/j2eetutorial14/examples/web/provided-wars/</code>. To open this WAR with <code class="cCode">deploytool</code>:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp214191"> </a><div class="pSmartList1"><li>Select File<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Open.</li></div><a name="wp214192"> </a><div class="pSmartList1"><li>Navigate to the <code class="cCode">provided-wars</code> directory.</li></div><a name="wp214193"> </a><div class="pSmartList1"><li>Select the WAR.</li></div><a name="wp214194"> </a><div class="pSmartList1"><li>Click Open Module.</li></div></ol></div> </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="WebApp4.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="WebApp6.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 + -