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.
public void setVariable(Stringname, Stringvalue)
IllegalArgumentException If the name parameter is not a valid CFML variable name.
| Parameter | Description |
|---|---|
|
name |
The name of the variable to set |
|
value |
The value to set the variable to |
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" ) ;
}