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

getQuery

Retrieves the query that was passed to this tag.

To pass a query to a custom tag, you use the query attribute. It should be set to the name of a query (created using the cfquery tag). The query attribute is optional and should be used only by tags that process an existing dataset.

Returns the Query that was passed to the tag. If no query was passed, returns null.

Request interface

public Query getQuery()

The following example retrieves a query that was passed to a tag. If no query was passed, an exception is thrown:

Query query = request.getQuery() ;
if ( query == null )
{
   throw new Exception(  
   "Missing QUERY parameter. " +
   "You must pass a QUERY parameter in "
   "order for this tag to work correctly." ) ;   
} 

Contents > CFML Reference > ColdFusion Java CFX Reference > Request interface > getQuery 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.