JSTL Early Access Beware — API and Tags may/will change support   development   comments to JSR052 EG
JSTL Examples    IntroductionIteratorsConditionalsEL Support MiscEcmaScriptImport

Conditional Tags Examples

<if> Simple Conditional Execution  

Only shows a customer from the customer list if the last name is "Howe".

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


JSTL Early Access Beware — API and Tags may/will change support    development   comments to JSR052 EG