Any non-JSP code in a JSP file is called template text and is automatically written to the output stream. The JSTL tags and make it possible to dynamically generate template text depending on a condition. The tag generates its body if the expression in the test attribute evaluates to the boolean value true or the string value "true":
Generate this template text if p equals someValue
Generate this template text if p equals "true"
An if/else action requires the use of the tag:
Generate this template text if p equals someValue
Otherwise generate this template text
Multiple conditions can be evaluated using the tag:
Generate this template text if p equals 0
Generate this template text if p equals 1
Generate this template text if p equals anything else
The can also be used to conditionally generate template text. If the value attribute is null, a default value (if specified) is generated. The default value can be specified using the default attribute or can be specified in the body content. This example demonstrates both methods:
Generate this if p is null