| <html><!-- #BeginTemplate "/Templates/ExamplesTemplate.dwt" --> |
| <head> |
| <!-- #BeginEditable "doctitle" --> |
| <title>JSTL: Conditional Tags Examples</title> |
| <!-- #EndEditable --> |
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
| <link rel="stylesheet" href="../global.css" type="text/css"> |
| </head> |
| |
| <body bgcolor="#FFFFFF" text="#000000"> |
| <table width="100%" border="0" cellpadding="5"> |
| <tr> |
| <td height="0"><font color="#000099"><b>standard taglib • implementation |
| of the JSP Standard Tag Library</b></font></td> |
| </tr> |
| <tr> |
| <td bgcolor="#CCCCFF"><font size="-1">Examples <a href="../index.html">Introduction</a> |
| • <a href="../elsupport/index.html">General Purpose</a> |
| • <a href="index.html">Conditionals</a> |
| • <a href="../iterators/index.html">Iterators</a> • |
| <a href="../import/index.jsp">Import</a> • <a href="../format/index.html">I18N |
| & Formatting</a> • <a href="../xml/index.html">XML</a> |
| • <a href="../sql/index.jsp">SQL</a> • <a href="../functions/index.html">Functions</a> |
| • <a href="../tlv/index.html">TLV</a> |
| </font></td> |
| </tr> |
| </table> |
| <!-- #BeginEditable "body" --> |
| <h2>Conditional Tags Examples</h2> |
| |
| <h3><if> Simple Conditional Execution <a href="../ShowSource.jsp?filename=/conditionals/If.jsp"><img |
| src="../images/code.gif" width="24" height="24" border="0"></a> |
| <a href="If.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a> |
| </h3> |
| Only shows a customer from the customer list if they are living in the "USA".<br> |
| |
| <h3> <choose> Mutually Exclusive Conditional Execution <a |
| href="../ShowSource.jsp?filename=/conditionals/Choose.jsp"><img src="../images/code.gif" width="24" height="24"" |
| border="0"></a> |
| <a href="Choose.jsp"><img src="../images/execute.gif" width="24" height="24" border="0"></a> |
| </h3> |
| |
| <p>Customers from the USA will be printed in blue, those from Canada in red, and |
| others in green.</p> |
| |
| <h3>Custom Logic Tag <a href="../ShowSource.jsp?filename=/conditionals/CustomLogicTag.jsp"><img |
| src="../images/code.gif" width="24" height="24" border="0"></a> <a href="CustomLogicTag.jsp"><img |
| src="../images/execute.gif" width="24" height="24" border="0"></a></h3> |
| |
| <p>JSTL exposes in its API the abstract class ConditionalTagSupport to facilitate |
| the implementation of custom conditional tags that leverage the standard conditional |
| behavior defined in JSTL. This example shows custom tag <usCustomer> that |
| returns true if its customer attribute value points to a US customer. It can |
| be used both in the context of a simple conditional execution, as well as in |
| the context of a mutually conditional execution by exposing the result of the |
| conditional execution in a JSP page attribute via the tag attribute 'var'. </p> |
| <!-- #EndEditable --> |
| <hr noshade color="#000099"> |
| <table width="100%" border="0" cellpadding="5"> |
| <tr> |
| <td height="24"><font color="#000099"><b>standard taglib • implementation |
| of the JSP Standard Tag Library</b></font></td> |
| </tr> |
| </table> |
| </body> |
| <!-- #EndTemplate --></html> |