⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webapp8.html

📁 j2eePDF格式的电子书
💻 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>Updating 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="WebApp7.html" />    <link rel="Next" href="WebApp9.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="WebApp7.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="WebApp9.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="wp210048"> </a><h2 class="pHeading1">Updating Web Modules</h2><a name="wp210049"> </a><p class="pBody">A typical iterative development cycle involves deploying a Web module and then making changes to the application components. In order to update a deployed Web module, you must:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp210051"> </a><div class="pSmartList1"><li>Recompile any modified classes.</li></div><a name="wp210052"> </a><div class="pSmartList1"><li>If you have deployed a packaged Web module, update any modified components in the WAR.</li></div><a name="wp210053"> </a><div class="pSmartList1"><li>Redeploy the module.</li></div><a name="wp210054"> </a><div class="pSmartList1"><li>Reload the URL in the client.</li></div></ol></div><a name="wp214487"> </a><h3 class="pHeading2">Updating an Unpackaged Web Module</h3><a name="wp214490"> </a><p class="pBody">To update an unpackaged Web module using either of the methods discussed in <a  href="WebApp6.html#wp214207">Deploying an Unpackaged Web Module</a>, reexecute the deploy operation. If you have only changed JSP pages in the Web module directory, you do not have to redeploy; simply reload the URL in the client.</p><a name="wp214492"> </a><h3 class="pHeading2">Updating a Packaged Web Module</h3><a name="wp214493"> </a><p class="pBody">This section describes how to update the <code class="cCode">hello1</code> Web module that you packaged with <code class="cCode">deploytool</code>.</p><a name="wp214494"> </a><p class="pBody">First, change the greeting in the file <code class="cCode">&lt;</code><code class="cVariable">INSTALL</code><code class="cCode">&gt;/j2eetutorial14/examples/web/hello1/web/index.jsp</code> to:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">&lt;h2&gt;Hi, my name is Duke. What&#39;s yours?&lt;/h2&gt;<a name="wp214495"> </a></pre></div><a name="wp214496"> </a><p class="pBody">Run <code class="cCode">asant</code> <code class="cCode">build</code> to copy the modified JSP page into the <code class="cCode">build</code> directory. To update the Web module using deploytool:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp214497"> </a><div class="pSmartList1"><li>Select the <code class="cCode">hello1</code> WAR.</li></div><a name="wp214498"> </a><div class="pSmartList1"><li>Select Tools<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Update Module Files. A popup dialog will display the modified file. Click OK.</li></div><a name="wp214499"> </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><a name="wp214500"> </a><div class="pSmartList1"><li>Select Tools<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Deploy. A popup dialog will query whether you want to redeploy. Click Yes.</li></div><a name="wp214501"> </a><div class="pSmartList1"><li>Click OK.</li></div></ol></div><a name="wp214502"> </a><p class="pBody">To view the modified module, reload the URL in the browser.</p><a name="wp214506"> </a><p class="pBody">You should see the screen in <a  href="WebApp8.html#wp214516">Figure 3-4</a> in the browser:</p><a name="wp214514"> </a><p class="pBody"></p><div align="left"><img src="images/Fig224.gif" height="244" width="407" alt="New Greeting" border="0" hspace="0" vspace="0"/></div><p class="pBody"></p><p>  <a name="214516"> </a><strong><font >Figure 3-4    New Greeting</font></strong></p><a name="wp214517"> </a><h3 class="pHeading2">Dynamic Reloading</h3><a name="wp215632"> </a><p class="pBody">If dynamic reloading is enabled, you do not have to redeploy an application or module when you change its code or deployment descriptors. All you have to do is copy the changed JSP or class files into the deployment directory for the application or module. The deployment directory for a Web module named <code class="cVariable">context_root</code> is <code class="cCode">&lt;</code><code class="cVariable">J2EE_HOME</code><code class="cCode">&gt;/domains/domain1/applications/j2ee-modules/</code><code class="cVariable">context_root</code>. The server checks for changes periodically and redeploys the application, automatically and dynamically, with the changes.</p><a name="wp214519"> </a><p class="pBody">This is useful in a development environment, because it allows code changes to be tested quickly. Dynamic reloading is not recommended for a production environment, however, because it may degrade performance. In addition, whenever a reload is done, the sessions at that time become invalid and the client must restart the session.</p><a name="wp214520"> </a><p class="pBody">To enable dynamic reloading, use the J2EE 1.4 Admin Console:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp214521"> </a><div class="pSmartList1"><li>Select the Applications node.</li></div><a name="wp214522"> </a><div class="pSmartList1"><li>Check the Reload Enabled box to enable dynamic reloading.</li></div><a name="wp214523"> </a><div class="pSmartList1"><li>Enter a number of seconds in the Reload Poll Interval field to set the interval at which applications and modules are checked for code changes and dynamically reloaded.</li></div><a name="wp214524"> </a><div class="pSmartList1"><li>Click the Save button.</li></div></ol></div><a name="wp214525"> </a><p class="pBody">In addition, to load new servlet files or reload deployment descriptor changes, you must do the following:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp214526"> </a><div class="pSmartList1"><li>Create an empty file named <code class="cCode">.reload</code> at the root of the module:</li></div><a name="wp214527"> </a><p class="pBodyRelative"><code class="cCode">&lt;</code><code class="cVariable">J2EE_HOME</code><code class="cCode">&gt;/domains/domain1/applications/j2ee-modules/</code><code class="cVariable">context_root</code><code class="cCode">/.reload</code></p><a name="wp214528"> </a><div class="pSmartList1"><li>Explicitly update the <code class="cCode">.reload</code> file's timestamp each time you make the above changes. On UNIX, execute <code class="cCode">touch</code> <code class="cCode">.reload</code>.</li></div></ol></div><a name="wp214529"> </a><p class="pBody">For JSP pages, changes are reloaded automatically at a frequency set in the Reload Pool Interval. To disable dynamic reloading of JSP pages, set the reload-interval property to -1.</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="WebApp7.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="WebApp9.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 + -