standard taglib * implementation of the JSP Standard Tag Library * 
Examples     Introduction * General Purpose * Conditionals * Iterators * Import * I18N & Formatting Tags * XML Tags * Misc.

Conditional Tags Examples

<if> Simple Conditional Execution  

Only shows a customer from the customer list if they are living in the USA.

<choose> Mutually Exclusive Conditional Execution  

Customers from the USA will be printed in blue, those from Canada in red, and others in green.

Custom Logic Tag  

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 the custom tag <usCustomer> that returns true if its customer attribute value points to a customer who lives in the USA. It can be used both in the context of a simple conditional execution and in the context of a mutually conditional execution by exposing the result of the conditional execution in a JSP page attribute by using the tag attribute var.

standard taglib * implementation of the JSP Standard Tag Library * 


Copyright 2006 Sun Microsystems, Inc. All rights reserved.