📄 ejb11.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>Modifying the J2EE Application</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="EJB10.html" /> <link rel="Next" href="EJB12.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="EJB10.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="EJB12.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="wp81442"> </a><h2 class="pHeading1">Modifying the J2EE Application</h2><a name="wp81446"> </a><p class="pBody">The J2EE Application Server and <code class="cCode">deploytool</code> support iterative development. Whenever you make a change to a J2EE application, you must redeploy the application.</p><a name="wp80113"> </a><h3 class="pHeading2">Modifying a Class File</h3><a name="wp80114"> </a><p class="pBody">To modify a class file in an enterprise bean, you change the source code, recompile it, and redeploy the application. For example, if you want to change the exchange rate in the <code class="cCode">dollarToYen</code> business method of the <code class="cCode">ConverterBean</code> class, you would follow these steps.</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp80115"> </a><div class="pSmartList1"><li>Edit <code class="cCode">ConverterBean.java</code>.</li></div><a name="wp80116"> </a><div class="pSmartList1"><li>Recompile <code class="cCode">ConverterBean.java.</code></li></div><div class="pSmartList2"><ol type="a" class="pSmartList2"><a name="wp81495"> </a><div class="pSmartList2"><li>In a terminal window, go to the <code class="cCode"><</code><code class="cVariable">INSTALL</code><code class="cCode">>/j2eetutorial14/examples/ejb/converter/</code> subdirectory.</li></div><a name="wp81497"> </a><div class="pSmartList2"><li>Type <code class="cCode">asant build</code>.</li></div></ol></div><a name="wp80117"> </a><div class="pSmartList1"><li>In <code class="cCode">deploytool</code>, select Tools<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Update Module Files. </li></div><a name="wp80118"> </a><div class="pSmartList1"><li>The Update Files dialog box appears. If the modified files are listed at the top of the dialog, click OK and go to step 6. If the files are listed at the bottom, they have not been found. Select one of those files and click Edit Search Paths.</li></div><a name="wp80119"> </a><div class="pSmartList1"><li>In the Edit Search Paths dialog, specify the directories where the Update Files dialog will search for modified files.</li></div><div class="pSmartList2"><ol type="a" class="pSmartList2"><a name="wp80120"> </a><div class="pSmartList2"><li>In the Search Root field, enter the fully-qualified name of the directory from which the search will start.</li></div><a name="wp80121"> </a><div class="pSmartList2"><li>In the Path Directory list, add a row for each directory that you want searched. Unless fully-qualified, these directory names are relative to the Search Root field.</li></div><a name="wp80122"> </a><div class="pSmartList2"><li>Click OK.</li></div></ol></div><a name="wp80123"> </a><div class="pSmartList1"><li>Select Tools<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Deploy. Make sure the checkbox labeled Save Object Before Deploying is checked. If you do not want to deploy at this time, select Tools<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Save to save the search paths specified in step 5.</li></div></ol></div><a name="wp80125"> </a><p class="pBody">To modify the contents of a WAR file you follow the preceding steps. The Update Files operation checks to see if any files have changed, including HTML files and JSP pages. If you change the <code class="cCode">index.jsp</code> file of <code class="cCode">ConverterApp</code>, be sure to type <code class="cCode">asant</code>. This task copies the <code class="cCode">index.jsp</code> file from the <code class="cCode">web</code> to the <code class="cCode">build</code> directory. </p><a name="wp80126"> </a><h3 class="pHeading2">Adding a File</h3><a name="wp80127"> </a><p class="pBody">To add a file to the EJB JAR or WAR of the application, perform these steps.</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp80128"> </a><div class="pSmartList1"><li>In <code class="cCode">deploytool</code>, select the JAR or WAR in the tree.</li></div><a name="wp80129"> </a><div class="pSmartList1"><li>Select the General tab.</li></div><a name="wp80130"> </a><div class="pSmartList1"><li>Click Edit.</li></div><a name="wp80131"> </a><div class="pSmartList1"><li>In the tree of the Available Files field, locate the file and click Add.</li></div><a name="wp80132"> </a><div class="pSmartList1"><li>Click OK.</li></div><a name="wp80133"> </a><div class="pSmartList1"><li>From the main toolbar, select Tools<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Update Module Files.</li></div><a name="wp81838"> </a><div class="pSmartList1"><li>Select Tools<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Deploy.</li></div></ol></div><a name="wp80134"> </a><h3 class="pHeading2"> Modifying a Deployment Setting</h3><a name="wp80135"> </a><p class="pBody">To modify a deployment setting of <code class="cCode">ConverterApp</code>, you edit the appropriate field in a tabbed pane and redeploy the application. For example, to change a JNDI name from <code class="cCode">ATypo</code> to <code class="cCode">ConverterEJB</code>, you would follow these steps.</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp80136"> </a><div class="pSmartList1"><li>In <code class="cCode">deploytool</code>, select <code class="cCode">ConverterApp</code> in the tree.</li></div><a name="wp80137"> </a><div class="pSmartList1"><li>Select the JNDI Names tab.</li></div><a name="wp80138"> </a><div class="pSmartList1"><li>In the JNDI Name field, enter <code class="cCode">MyConverter</code>.</li></div><a name="wp80139"> </a><div class="pSmartList1"><li>From the main toolbar, select File<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Save.</li></div><a name="wp80140"> </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.</li></div><a name="wp81859"> </a><div class="pSmartList1"><li>Select Tools<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Deploy.</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="EJB10.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="EJB12.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 + -