Skip to main content
Skip table of contents

setBoolean

A logic command that sets a variable with a Boolean value into the variable context.

Attributes

var

Required

Value type

EL-evaluated

Yes

String

No

Defines the name of the variable that will hold the Boolean.

value

Required

Value type

EL-evaluated

No

Any

Depends on the valueExpression attribute

Defines the Boolean value this command is setting. If the resolved value is a Boolean, that Boolean is used as is. If the resolved value is of any other kind, it is converted into a String (unless it is a String already) and if its content is "true", the set Boolean is true, otherwise the Boolean is false.

If undefined or the resolved value is null, the Boolean false is set.

expressionType

Required

Value type

EL-evaluated

No

String

Yes

Defines how the value expression of the value attribute is resolved. The resolved String value of this attribute is expected to be one of the following:

  • el - The value attribute is handled like a normal EL-evaluated attribute.

  • shorthandEL - The value attribute is EL-evaluated, but if the value expression doesn't contain the ${ and }, the expression is evaluated as if it was wrapped within them.

  • static - The value attribute is not EL-evaluated, so the resolved value will always be a String. 

If this attribute is undefined, the value of "el" is used. 

Examples

The setBoolean command provides an easy way to create Boolean values. While the set command can create Boolean values as well, this command is guaranteed to always produce a Boolean, regardless of how its value is defined (or not defined at all). To have setBoolean create a Boolean true, all of the following would work:

CODE
<setBoolean var="itsTrue" value="${true}"><setBoolean var="itsTrue2" value="true"><setBoolean var="itsTrue3" value="${itsTrue}">

Creating a Boolean false is generally easier, as if value doesn't resolve into a Boolean true or the String "true" - or is simply undefined - the resulting Boolean is false.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.