CFLib.org – Common Function Library Project

forward(theurl)

Last updated October 20, 2003

author

Thomas Bukowski

Version: 1 | Requires: CF6 | Library: UtilityLib

Description:
This UDF performs a serverside redirection through getPageContext(). This redirect must be to a relative location on the server. Unlike <cflocation>, this UDF does not send a 302 header to the browser to ask for a redirect - instead, the Coldfusion server stops executing the current page and starts executing the new page; this is done by accessing the J2EE backend behind Coldfusion MX with the use of the internal function getPageContext(). For furthering information on accessing the J2EE backend, see: http://www.macromedia.com/devnet/mx/coldfusion/articles/java.html Also, note that using this function (or the getPageContext().forward() function) when you have data in the Form scope throws the java err.io.short_read error in Coldfusion MX versions eariler then Update Release 3. More information: http://www.macromedia.com/support/coldfusion/releasenotes/mx/releasenotes_mx_updater01.html (Scroll down to CFML Function-Related Issues)

Return Values:
Returns nothing.

Example:

<cfscript>
/* view only example
forward("/foo.cfm");
*/
</cfscript>

Parameters:

Name Description Required
theurl The URL to redirect to. Must be relative. Yes

Full UDF Source:

/**
 * Performs a serverside redirection.
 * 
 * @param theurl      The URL to redirect to. Must be relative. (Required)
 * @return Returns nothing. 
 * @author Thomas Bukowski (me@neodude.net) 
 * @version 1, October 20, 2003 
 */
function forward(theurl){
    getPageContext().forward(theurl);
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson