Contents > CFML Reference > ColdFusion Java CFX Reference > Request interface > getIntAttribute PreviousNext

getIntAttribute

Retrieves the value of the passed attribute as an integer. Returns -1 if the attribute does not exist. Use attributeExists to test whether an attribute was passed to the tag. Use getIntAttribute(String,int) to return a default value rather than throwing an exception or returning -1.

Returns the value of the attribute passed to the tag. If no attribute of that name was passed to the tag, -1 is returned.

Request interface

public int getIntAttribute(String name)

NumberFormatException If the attribute is not a valid number.

attributeExists, getAttributeList, getIntAttribute

Parameter

Description

name

The attribute to retrieve (case-insensitive)

The following example retrieves an attribute named PORT and writes its value back to the user:

int nPort = request.getIntAttribute("PORT") ;
if ( nPort != -1 )
   response.write( "The port is: " + String.valueOf(nPort) ) ; 

Contents > CFML Reference > ColdFusion Java CFX Reference > Request interface > getIntAttribute PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.