Previous Section
Table of Contents
Next Section


Chapter 13: The Logic Tag Library

Overview

The Logic Tag Library provides a rich set of tags for cleanly implementing simple conditional logic in JSPs. With these tags you can wrap content that will be processed only when a particular condition is true. For example, you can use the equal tag to wrap content that is conditionally processed based on whether two specified values are equal or not. The following snippet illustrates this:

<logic:equal name="resultCount" value="0">
Search returned no results.
</logic:equal>

If the object specified by the name attribute is equal to “0”, as specified by the value attribute, then the content between the starting and ending equal tags will be processed. Otherwise, the content will be ignored.

Note that the Logic Library has two tags that are not used for conditional logic: the iterate tag and the redirect tag. The iterate tag is used to wrap content that should be processed for each element of a collection, and the redirect tag is used to send an HTTP redirect response to a browser, causing it to load another page.



Previous Section
Table of Contents
Next Section