blob: 156c8d96b4a88191f9922cd27b3de7f76b5e6a80 [file] [log] [blame]
<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 &#149; implementation
of the JSP Standard Tag Library</b></font></td>
</tr>
<tr>
<td bgcolor="#CCCCFF"><font size="-1">Examples &nbsp;&nbsp;&nbsp;&nbsp;<a href="../index.html">Introduction</a>
&#149; <a href="../elsupport/index.html">General Purpose</a>
&#149; <a href="index.html">Conditionals</a>
&#149; <a href="../iterators/index.html">Iterators</a> &#149;
<a href="../import/index.jsp">Import</a> &#149; <a href="../format/index.html">I18N
& Formatting</a> &#149; <a href="../xml/index.html">XML</a>
&#149; <a href="../sql/index.jsp">SQL</a> &#149; <a href="../functions/index.html">Functions</a>
&#149; <a href="../tlv/index.html">TLV</a>
</font></td>
</tr>
</table>
<!-- #BeginEditable "body" -->
<h2>Conditional Tags Examples</h2>
<h3>&lt;if&gt; Simple Conditional Execution&nbsp;&nbsp; <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 &quot;USA&quot;.<br>
<h3> &lt;choose&gt;&nbsp;Mutually Exclusive Conditional Execution&nbsp;<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&nbsp;&nbsp;<a href="../ShowSource.jsp?filename=/conditionals/CustomLogicTag.jsp"><img
src="../images/code.gif" width="24" height="24" border="0"></a>&nbsp;<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 &lt;usCustomer&gt; 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 &#149; implementation
of the JSP Standard Tag Library</b></font></td>
</tr>
</table>
</body>
<!-- #EndTemplate --></html>