Chapter 13: The Logic Tag Library

 < Day Day Up > 


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.

 < Day Day Up > 

Struts. The Complete Reference
Struts: The Complete Reference, 2nd Edition
ISBN: 0072263865
EAN: 2147483647
Year: 2003
Pages: 134
Authors: James Holmes

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: