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);
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson