Chapter 18: Building Custom CFAPI Tags
Throws:
NumberFormatException
See Also:
attributeExists, getAttributeList, getIntAttribute(String,int)
getAttributeList
public String[] getAttributeList()
Retrieves a list of all attributes passed to the tag. To retrieve the value of an
individual attribute you should use the getAttribute member function.
The following example retrieves the list of attributes and 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++ )
{
}
Returns:
An array of strings containing the names of the attributes passed to the tag.
See Also:
attributeExists, getAttribute
getQuery
public Query getQuery()
Retrieves the query that was passed to this tag.
To pass a query to a custom tag you use the QUERY attribute. This attribute should
be set to the name of an existing query (e.g. created using the CFQUERY tag). The
QUERY attribute is optional and should only be used by tags which need to
process an existing dataset.
The following example retrieves the query which was passed to the tag. If no query
was passed then an exception is thrown:
Query query = request.getQuery() ;
if ( query == null )
{
— If the attribute is not a valid number.
String strName = attribs[i] ;
String strValue = request.getAttribute( strName ) ;
response.write( strName + "=" + strValue + "<BR>" ) ;
throw new Exception(
"Missing QUERY parameter. " +
"You must pass a QUERY parameter in "
319
Need help?
Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?