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

📄 jspintro2.html

📁 j2eePDF格式的电子书
💻 HTML
📖 第 1 页 / 共 2 页
字号:
&nbsp;&nbsp;&nbsp;&nbsp;&lt;<code class="cCodeBold">c:choose</code>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;<code class="cCodeBold">c:when</code> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;test=&quot;<code class="cCodeBold">${f:equals(selectedLocaleString,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;localeString)}</code>&quot; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;option selected&gt;<code class="cCodeBold">${localeString}</code>&lt;/option&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/c:when&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;c:otherwise&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;option&gt;<code class="cCodeBold">${localeString}</code>&lt;/option&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/c:otherwise&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/c:choose&gt;&nbsp;&nbsp;&lt;/c:when&gt;&nbsp;&nbsp;&lt;<code class="cCodeBold">c:otherwise</code>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;option&gt;<code class="cCodeBold">${localeString}</code>&lt;/option&gt;&nbsp;&nbsp;&lt;/c:otherwise&gt;&lt;/c:choose&gt;&lt;/c:forEach&gt;&lt;/select&gt;&lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Get Date&quot;&gt;&lt;/form&gt;&lt;<code class="cCodeBold">c:if</code> test=&quot;${selectedFlag}&quot; &gt;&nbsp;&nbsp;&lt;<code class="cCodeBold">jsp:setProperty</code> name=&quot;locales&quot;&nbsp;&nbsp;&nbsp;&nbsp;property=&quot;selectedLocaleString&quot;&nbsp;&nbsp;&nbsp;&nbsp;value=&quot;<code class="cCodeBold">${selectedLocaleString}</code>&quot; /&gt;&nbsp;&nbsp;&lt;<code class="cCodeBold">jsp:useBean</code> id=&quot;date&quot; class=&quot;mypkg.MyDate&quot;/&gt;&nbsp;&nbsp;&lt;<code class="cCodeBold">jsp:setProperty</code> name=&quot;date&quot; property=&quot;locale&quot;&nbsp;&nbsp;&nbsp;&nbsp;value=&quot;<code class="cCodeBold">${locales.selectedLocale}</code>&quot;/&gt;&nbsp;&nbsp;&lt;b&gt;Date: &lt;/b&gt;<code class="cCodeBold">${date.date}</code>&lt;/c:if&gt;&lt;/body&gt;&lt;/html&gt;<a name="wp75698"> </a></pre></div></ul></div><a name="wp85262"> </a><p class="pBody">A sample <code class="cCode">date.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 execute this example:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp85353"> </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/date/</code>.</li></div><a name="wp85354"> </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">&lt;</code><code class="cVariable">INSTALL</code><code class="cCode">&gt;/j2eetutorial14/examples/web/date/build/</code> directory. </li></div><a name="wp85355"> </a><div class="pSmartList1"><li>Start the J2EE application server.</li></div><a name="wp96781"> </a><div class="pSmartList1"><li>Start <code class="cCode">deploytool</code>. </li></div><a name="wp96782"> </a><div class="pSmartList1"><li>Create a Web application called <code class="cCode">date</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="wp96783"> </a><div class="pSmartList1"><li>New Web Component Wizard</li></div><div class="pSmartList2"><ol type="a" class="pSmartList2"><a name="wp96784"> </a><div class="pSmartList2"><li>Select the Create New Stand-Alone WAR Module radio button.</li></div><a name="wp96785"> </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;/docs/tutorial/examples/web/date/date.war</code>.</li></div><a name="wp96786"> </a><div class="pSmartList2"><li>In the WAR Name field, enter <code class="cCode">date</code>.</li></div><a name="wp96787"> </a><div class="pSmartList2"><li>In the Context Root field, enter <code class="cCode">/date</code>.</li></div><a name="wp96788"> </a><div class="pSmartList2"><li>Click Edit. </li></div><a name="wp96789"> </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/date/build/</code>. Select the <code class="cCode">index.jsp</code> JSP page and the <code class="cCode">mypkg</code> package and click Add, then click OK.</li></div><a name="wp96790"> </a><div class="pSmartList2"><li>Click Next.</li></div><a name="wp96791"> </a><div class="pSmartList2"><li>Select the JSP radio button. </li></div><a name="wp96792"> </a><div class="pSmartList2"><li>Click Next.</li></div><a name="wp96793"> </a><div class="pSmartList2"><li>Select <code class="cCode">index.jsp</code> from the JSP file combo box. </li></div><a name="wp96794"> </a><div class="pSmartList2"><li>Click Finish.</li></div></ol></div><a name="wp96795"> </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="wp96796"> </a><div class="pSmartList1"><li>Deploy the application. </li></div><div class="pSmartList2"><ol type="a" class="pSmartList2"><a name="wp96797"> </a><div class="pSmartList2"><li>Select Tools<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Deploy. </li></div><a name="wp96798"> </a><div class="pSmartList2"><li>In the Connection Settings frame, enter the user name and password you specified when you installed the J2EE 1.4 Application Server.</li></div><a name="wp96799"> </a><div class="pSmartList2"><li>Click OK.</li></div><a name="wp96800"> </a><div class="pSmartList2"><li>A popup dialog will display the results of the deployment. Click Close.</li></div></ol></div><a name="wp66484"> </a><div class="pSmartList1"><li>Set the character encoding in your browser to UTF-8. </li></div><a name="wp84619"> </a><div class="pSmartList1"><li>Open the URL <code class="cCode">http://localhost:8080/date</code> in a browser.</li></div></ol></div><a name="wp83412"> </a><p class="pBody">You will see a combo box whose entries are locales. Select a locale and click Get Date. You will see the date expressed in a manner appropriate for that locale. </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="JSPIntro.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="JSPIntro3.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 + -