📄 jspintro2.html
字号:
<<code class="cCodeBold">c:choose</code>> <<code class="cCodeBold">c:when</code> test="<code class="cCodeBold">${f:equals(selectedLocaleString, localeString)}</code>" > <option selected><code class="cCodeBold">${localeString}</code></option> </c:when> <c:otherwise> <option><code class="cCodeBold">${localeString}</code></option> </c:otherwise> </c:choose> </c:when> <<code class="cCodeBold">c:otherwise</code>> <option><code class="cCodeBold">${localeString}</code></option> </c:otherwise></c:choose></c:forEach></select><input type="submit" name="Submit" value="Get Date"></form><<code class="cCodeBold">c:if</code> test="${selectedFlag}" > <<code class="cCodeBold">jsp:setProperty</code> name="locales" property="selectedLocaleString" value="<code class="cCodeBold">${selectedLocaleString}</code>" /> <<code class="cCodeBold">jsp:useBean</code> id="date" class="mypkg.MyDate"/> <<code class="cCodeBold">jsp:setProperty</code> name="date" property="locale" value="<code class="cCodeBold">${locales.selectedLocale}</code>"/> <b>Date: </b><code class="cCodeBold">${date.date}</code></c:if></body></html><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"><</code><code class="cVariable">INSTALL</code><code class="cCode">>/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"> <</code><code class="cVariable">INSTALL</code><code class="cCode">>/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"><</code><code class="cVariable">INSTALL</code><code class="cCode">>/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"><</code><code class="cVariable">INSTALL</code><code class="cCode">>/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"><</code><code class="cVariable">INSTALL</code><code class="cCode">>/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 + -