Logic Tags


This library provides a basic set of logic tags.

Many of these tags have a scope argument. The valid values for the scope argument are "tag", "portlet request", "http request", "session", "persistent session", "application". These values are not case-sensitive, although it is considered a best practice to use all lower case.

Various tags also set editable shared variables as part of their execution. If a variable with the same name already exists, it will be overwritten. If the pre-existing variable is not editable, then the tag will fail. Variable names cannot contain the reserved character '.'.

Tag Library Information
Namelogic
Version1.1
 

Tag Summary
boolexprThis tag evaluates a boolean expression and stores the result as a boolean in memory. It is designed to work with the logic.if tag.
collectionlengthThis tag evaluates the length of a collection and stores the result in memory.
collectionThis tag creates a data collection (a collection of variables, such as data objects) and stores it as an editable shared variable using the key supplied in the tag attributes. It is stored in in Portlet Request scope by default. The variable is only stored after this tag is finished processing it's contents. The collection tag does not append to a pre-existing collection, but will just overwrite it instead. To clear a collection, simply use this tag with no data or variable tags inside it. This collection variable can be used with the foreach tag. This tag will process nested tags to populate the data collection, but will not output any HTML. This tag also creates a temporary editable shared variable stored using the key collection. Be careful not to create a collection with different types of variables, such as string variables and data objects.
concatThis tag concatenates two values into one and sets the new value in a variable with a specified name.
containsexprThis tag checks if an collection contains a specific data element and sets a specified variable to true or false. It is designed to work with the logic.if tag.
dataThis tag creates a data object (a collection of name value pairs) and stores it as an editable shared variable using the key supplied in the tag attributes. This tag can also be used inside the collection tag, in which case the key attribute is not necessary and the name value pairs will be stored directly in the parent collection. The key attribute is required otherwise. The XML attributes (non pt: attributes) for this tag are used as name value pairs for the data object. It is stored in in Portlet Request scope by default. This variable can be used in attribute value replacement or with the value tag.
foreachThis tag allows you to loop over data collections stored in memory as XPArrayLists. The data collection should not be modified while looping to avoid unpredictable side effects.
iffalseThis tag is displayed if the surrounding if tag evaluates to false.
ifThis tag evaluates an expression and then displays either the if-true or if-false tag contents.
iftrueThis tag is displayed if the surrounding if tag evaluates to true.
intexprThis tag evaluates an integer expression and stores the result as a boolean in memory. It is designed to work with the logic.if tag.
separatorThis tag allows you to display a separator in between elements of a foreach loop without displaying an extra one at the end. Content in this tag will be displayed for every iteration of the loop except the last.
stringexprThis tag evaluates whether or not two strings are equal and stores the result as a boolean in memory. Case must match. It is designed to work with the logic.if tag.
valueThis tag evaluates the attribute as a Transformer Tag attribute and displays the value.

This tag does not display the contents of the tag and should only be used as a singleton tag (i.e. <pt:logic.value/>), rather than as a tag with both an open and close tag.

variableThis tag stores an editable shared variable using the key and value supplied in the tag attributes. This tag can also be used inside the collection tag, in which case the key attribute is not necessary and the name value pairs will be stored directly in the parent collection. The key attribute is required otherwise. It is stored in Portlet Request scope by default. This variable can be used in attribute value replacement or with the value tag.
 


Java, JSP, and JavaServer Pages are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 2002-3 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054, U.S.A. All Rights Reserved.