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 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'.

standard taglib * implementation of the JSP Standard Tag Library *