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

📄 jstl2.html

📁 j2eePDF格式的电子书
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<?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="JSTL.html" />    <link rel="Next" href="JSTL3.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="JSTL.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="JSTL3.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="wp83467"> </a><h2 class="pHeading1">The Example JSP Pages</h2><a name="wp83469"> </a><p class="pBody">This chapter illustrates JSTL with excerpts from the JSP version of the Duke's Bookstore application discussed in Chapter <a  href="JSPIntro.html#wp65706">12</a> rewritten to replace the JavaBeans component database helper object with direct calls to the database via the JSTL SQL tags. For most applications, it is better to encapsulate calls to a database in a bean. JSTL includes SQL tags for situations where a new application is being prototyped and the overhead of creating a bean may not be warranted.</p><a name="wp82073"> </a><p class="pBody">The source for the Duke's Bookstore application is located in the <code class="cCode">&lt;</code><code class="cVariable">INSTALL</code><code class="cCode">&gt;/j2eetutorial14/examples/web/bookstore4/</code> directory created when you unzip the tutorial bundle (see <a  href="About.html#wp63740">About the Examples</a>). A sample <code class="cCode">bookstore4.war</code> is provided in <code class="cCode">&lt;</code><code class="cVariable">INSTALL</code><code class="cCode">&gt;/j2eetutorial14/examples/web/provided-wars/</code>. To build, package, deploy, and run the example:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp86856"> </a><div class="pSmartList1"><li>Build and package the bookstore common files as described in <a  href="WebApp12.html#wp189559">Duke's Bookstore Examples</a>. </li></div><a name="wp86367"> </a><div class="pSmartList1"><li>In a terminal window, go to <code class="cCode">&lt;</code><code class="cVariable">INSTALL</code><code class="cCode">&gt;/j2eetutorial14/examples/web/bookstore4/</code>.</li></div><a name="wp86999"> </a><div class="pSmartList1"><li>Run <code class="cCode">asant</code> <code class="cCode">copy</code>. This target will copy files to the <code class="cCode">&lt;</code><code class="cVariable">INSTALL</code><code class="cCode">&gt;/j2eetutorial14/examples/web/bookstore4/build/</code> directory. </li></div><a name="wp87000"> </a><div class="pSmartList1"><li>Start the J2EE application server.</li></div><a name="wp87003"> </a><div class="pSmartList1"><li>Perform all the operations described in <a  href="WebApp13.html#wp69868">Accessing Databases from Web Applications</a>.</li></div><a name="wp89424"> </a><div class="pSmartList1"><li>Start <code class="cCode">deploytool</code>.</li></div><a name="wp89425"> </a><div class="pSmartList1"><li>Create a Web application called <code class="cCode">bookstore4</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="wp89426"> </a><div class="pSmartList1"><li>New Web Component Wizard</li></div><div class="pSmartList2"><ol type="a" class="pSmartList2"><a name="wp89427"> </a><div class="pSmartList2"><li>Select the Create New Stand-Alone WAR Module radio button.</li></div><a name="wp89428"> </a><div class="pSmartList2"><li>In the WAR Location field, enter <code class="cCode">&lt;</code><code class="cVariable">INSTALL</code><code class="cCode">&gt;/j2eetutorial14/examples/web/bookstore4/bookstore4.war</code>. </li></div><a name="wp89429"> </a><div class="pSmartList2"><li>In the WAR Name field, enter <code class="cCode">bookstore4</code>.</li></div><a name="wp89430"> </a><div class="pSmartList2"><li>In the Context Root field, enter <code class="cCode">/bookstore4</code>.</li></div><a name="wp89431"> </a><div class="pSmartList2"><li>Click Edit to add the content files. </li></div><a name="wp89432"> </a><div class="pSmartList2"><li>In the Edit Contents dialog, navigate to <code class="cCode">&lt;</code><code class="cVariable">INSTALL</code><code class="cCode">&gt;/j2eetutorial14/examples/web/bookstore4/build</code>/. Select the JSP pages <code class="cCode">bookstore.jsp</code>, <code class="cCode">bookdetails.jsp</code>, <code class="cCode">bookcatalog.jsp</code>, <code class="cCode">bookshowcart.jsp</code>, <code class="cCode">bookcashier.jsp</code>, <code class="cCode">bookreceipt.jsp</code> and the <code class="cCode">template</code> directory and click Add. </li></div><a name="wp89433"> </a><div class="pSmartList2"><li>Add the shared bookstore library. Navigate to<code class="cCode"> &lt;</code><code class="cVariable">INSTALL</code><code class="cCode">&gt;/j2eetutorial14/examples/build/web/bookstore/dist/</code>. Select <code class="cCode">bookstore.jar</code> and Click Add.</li></div><a name="wp89434"> </a><div class="pSmartList2"><li>Click OK.</li></div><a name="wp89435"> </a><div class="pSmartList2"><li>Click Next.</li></div><a name="wp89436"> </a><div class="pSmartList2"><li>Select the JSP radio button. </li></div><a name="wp89437"> </a><div class="pSmartList2"><li>Click Next.</li></div><a name="wp89438"> </a><div class="pSmartList2"><li>Select <code class="cCode">bookstore.jsp</code> from the JSP Filename combo box. </li></div><a name="wp89439"> </a><div class="pSmartList2"><li>Click Next.</li></div><a name="wp89440"> </a><div class="pSmartList2"><li>Click Add. Enter the alias <code class="cCode">/bookstore</code>.</li></div><a name="wp89441"> </a><div class="pSmartList2"><li>Click Finish.</li></div></ol></div><a name="wp89445"> </a><div class="pSmartList1"><li>Add each of the Web components listed in <a  href="JSTL2.html#wp89458">Table 14-1</a>. For each component:</li></div><div class="pSmartList2"><ol type="a" class="pSmartList2"><a name="wp89446"> </a><div class="pSmartList2"><li>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="wp89447"> </a><div class="pSmartList2"><li>Click the Add to Existing WAR Module radio button Since the WAR contains all of the JSP pages, you do not have to add any more content.</li></div><a name="wp89448"> </a><div class="pSmartList2"><li>Click Next.</li></div><a name="wp89449"> </a><div class="pSmartList2"><li>Select the JSP radio button and the Component Aliases checkbox. </li></div><a name="wp89450"> </a><div class="pSmartList2"><li>Click Next.</li></div><a name="wp89451"> </a><div class="pSmartList2"><li>Select the page from the JSP Filename combo box. </li></div><a name="wp89499"> </a><div class="pSmartList2"><li>Click Finish.<div align="left"><table border="1" id="wp89458">  <caption><a name="wp89458"> </a><div class="pTableTitle">Table 14-1   Duke's Bookstore Web Components&nbsp;</div></caption>  <tr align="center">    <th><a name="wp89464"> </a><div class="pCellHeading">Web Component Name</div></th>    <th><a name="wp89466"> </a><div class="pCellHeading">JSP Page</div></th>    <th><a name="wp89468"> </a><div class="pCellHeading">Alias</div></th></tr>  <tr align="left">    <td><a name="wp89470"> </a><div class="pCellBody"><code class="cCode">bookcatalog</code></div></td>    <td><a name="wp89472"> </a><div class="pCellBody"><code class="cCode">bookcatalog.jsp</code></div></td>    <td><a name="wp89474"> </a><div class="pCellBody"><code class="cCode">/bookcatalog</code></div></td></tr>  <tr align="left">    <td><a name="wp89476"> </a><div class="pCellBody"><code class="cCode">bookdetails</code></div></td>    <td><a name="wp89478"> </a><div class="pCellBody"><code class="cCode">bookdetails.jsp</code></div></td>    <td><a name="wp89480"> </a><div class="pCellBody"><code class="cCode">/bookdetails</code></div></td></tr>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -