Couple of Useful Custom Tags

It was pointed out the other day on a list that cfinclude doesn’t let you include JSP pages and that there is no cfforward tag to forward a request on to another resource (CFM, JSP, servlet, etc.). BlueDragon apparently does have this functionality. Well, now ColdFusion does, too, with the extremely simple tags below. And ColdFusion also has getPageContext(), as well.

<!---
The includeanything tag will include any type of page, not just a
CFM template.

@attribute page (required) Relative path to the template you want
to include.
--->
<cfif thisTag.executionMode is "start">
<cfparam name="attributes.page" />
<cfscript>
getPageContext().include(attributes.page);
</cfscript>
</cfif>

<!---
The forward tag will perform a server-side redirect.

@attribute page (required) Relative path to the template you want
to forward to.
--->
<cfif thisTag.executionMode is "start">
<cfparam name="attributes.page" />
<cfscript>
getPageContext().forward(attributes.page);
</cfscript>
</cfif>