Adobe ColdFusion 8

attributeExists

Description

Checks whether the attribute was passed to this tag.

Returns True if the attribute is available; otherwise returns False.

Category

Request interface

Syntax

public boolean attributeExists(String name)

See also

getAttribute, getAttributeList

Parameters

Parameter

Description

name

Name of the attribute to check (case-insensitive)

Example

The following example checks whether the user passed an attribute named DESTINATION to the tag; if not, it throws an exception:

if ( ! request.attributeExists("DESTINATION") )
{
    throw new Exception( 
    "Missing DESTINATION parameter",
    "You must pass a DESTINATION parameter in "
    "order for this tag to work correctly." ) ;
} ;