User Guide

Request interface 779
Example
The following example retrieves an attribute named DESTINATION and writes its value back to
the user:
String strDestination = request.getAttribute("DESTINATION") ;
response.write( "The destination is: " + strDestination ) ;
getAttributeList
Description
Retrieves a list of attributes passed to the tag. To retrieve the value of one attribute, use the
getAttribute member function.
Returns an array of strings containing the names of the attributes passed to the tag.
Category
Request interface
Syntax
public String[] getAttributeList()
See also
attributeExists
, getAttributeList
Example
The following example retrieves the list of attributes, then iterates over the list, writing each
attribute and its value back to the user:
String[] attribs = request.getAttributeList() ;
int nNumAttribs = attribs.length ;
for( int i = 0; i < nNumAttribs; i++ )
{
String strName = attribs[i] ;
String strValue = request.getAttribute( strName ) ;
response.write( strName + "=" + strValue + "<BR>" ) ;
}
getIntAttribute
Description
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.
Category
Request interface
Syntax
public int getIntAttribute(String name)