// Add data to the query
int iRow = query.addRow() ;
query.setData( iRow, iFirstName, "John" ) ;
query.setData( iRow, iLastName, "Smith" ) ;
iRow = query.addRow() ;
query.setData( iRow, iFirstName, "Jane" ) ;
query.setData( iRow, iLastName, "Doe" ) ;
setVariable
Description
Sets a variable in the calling template. If the variable name specified exists in the template, its
value is replaced. If it does not exist, a new variable is created.
Category
Response interface
Syntax
public void setVariable(String name, String value)
Throws
IllegalArgumentException
Parameters
Parameter
name
value
Example
For example, this code sets the value of a variable named MessageSent based on the success of an
operation performed by the custom tag:
boolean bMessageSent ;
...attempt to send the message...
if ( bMessageSent == true )
{
response.setVariable( "MessageSent", "Yes" ) ;
}
else
{
response.setVariable( "MessageSent", "No" ) ;
}
If the
name
Description
The name of the variable to set
The value to set the variable to
parameter is not a valid CFML variable name.
Response interface
783