📄 jspadvanced2.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>The Example JSP Pages</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="JSPAdvanced.html" /> <link rel="Next" href="JSPAdvanced3.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="JSPAdvanced.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="JSPAdvanced3.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="wp71778"> </a><h2 class="pHeading1">The Example JSP Pages</h2><a name="wp74390"> </a><p class="pBody">This chapter illustrates JSP scripting elements using a version of the <code class="cCode">hello2</code> example introduced in Chapter <a href="WebApp.html#wp83291">3</a>--<code class="cCode">webclient</code>--that accesses a Web service. To build, package, deploy, and run the <code class="cCode">webclient</code> example:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp74373"> </a><div class="pSmartList1"><li>Build and deploy the JAX-RPC Web service <code class="cCode">MyHelloService</code> described in <a href="JAXRPC4.html#wp115211">Creating a Web Service with JAX-RPC</a>.</li></div><a name="wp75013"> </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/jaxrpc/webclient/</code>.</li></div><a name="wp75014"> </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/jaxrpc/webclient/build/</code> directory. </li></div><a name="wp75015"> </a><div class="pSmartList1"><li>Start the J2EE application server.</li></div><a name="wp76000"> </a><div class="pSmartList1"><li>Start <code class="cCode">deploytool</code>.</li></div><a name="wp76001"> </a><div class="pSmartList1"><li>Create a Web application called <code class="cCode">webclient</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="wp76002"> </a><div class="pSmartList1"><li>New Web Component Wizard</li></div><div class="pSmartList2"><ol type="a" class="pSmartList2"><a name="wp76003"> </a><div class="pSmartList2"><li>Select the Create New Stand-Alone WAR Module radio button.</li></div><a name="wp76004"> </a><div class="pSmartList2"><li>Click Browse and in the file chooser, navigate to <code class="cCode"><</code><code class="cVariable">INSTALL</code><code class="cCode">>/j2eetutorial14/examples/jaxrpc/webclient/</code>. </li></div><a name="wp76005"> </a><div class="pSmartList2"><li>In the File Name field, enter <code class="cCode">webclient</code>.</li></div><a name="wp76006"> </a><div class="pSmartList2"><li>Click Choose Module File.</li></div><a name="wp76007"> </a><div class="pSmartList2"><li>In the WAR Display Name field enter <code class="cCode">webclient</code>.</li></div><a name="wp76008"> </a><div class="pSmartList2"><li>In the Context Root field, enter <code class="cCode">/webclient</code>.</li></div><a name="wp76009"> </a><div class="pSmartList2"><li>Click Edit to add the content files.</li></div><a name="wp76010"> </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/jaxrpc/webclient/build/</code>. Select <code class="cCode">duke.waving.gif</code>, <code class="cCode">greeting.jsp</code>, <code class="cCode">response.jsp</code>, and the <code class="cCode">webclient</code> directory and click Add. </li></div><a name="wp76011"> </a><div class="pSmartList2"><li>Click OK.</li></div><a name="wp76012"> </a><div class="pSmartList2"><li>Click Next.</li></div><a name="wp76013"> </a><div class="pSmartList2"><li>Select the JSP radio button. </li></div><a name="wp76014"> </a><div class="pSmartList2"><li>Click Next.</li></div><a name="wp76015"> </a><div class="pSmartList2"><li>Select <code class="cCode">greeting.jsp</code> from the Servlet Class combo box. </li></div><a name="wp76016"> </a><div class="pSmartList2"><li>Click Finish.</li></div></ol></div><a name="wp76017"> </a><div class="pSmartList1"><li>Add an alias to the greeting Web component. </li></div><div class="pSmartList2"><ol type="a" class="pSmartList2"><a name="wp76018"> </a><div class="pSmartList2"><li>Select the <code class="cCode">greeting</code> Web component.</li></div><a name="wp76019"> </a><div class="pSmartList2"><li>Select the Aliases tab. </li></div><a name="wp76020"> </a><div class="pSmartList2"><li>Click Add to add a new mapping.</li></div><a name="wp76021"> </a><div class="pSmartList2"><li>Type <code class="cCode">/greeting</code> in the aliases list.</li></div></ol></div><a name="wp76022"> </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="wp76023"> </a><div class="pSmartList1"><li>Deploy the WAR.</li></div><a name="wp74368"> </a><div class="pSmartList1"><li>Open your browser to <code class="cCode">http://localhost:8080/webclient/greeting</code></li></div></ol></div><hr><a name="wp75774"> </a><p class="pNote">Note: The example assumes that the Java WSDP runs on the default port, 8080. If you have changed the port, you must update the port number in the file <code class="cCode"><</code><code class="cVariable">INSTALL</code><code class="cCode">>/j2eetutorial14/examples/jaxrpc/webclient</code>/<code class="cCode">response.jsp </code>before building and running the examples.</p><hr> </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="JSPAdvanced.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="JSPAdvanced3.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 + -