Adobe COLDFUSION 9 Manual page 1136

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using Web Elements and External Objects
Scope
Can share data using
Request
forward, include
Note: Shared Request scope variable names in the JSP page or servlet must be all-lowercase.
Session
href, cfhttp, forward, include
Application
href, cfhttp, forward, include
Note: When you share data between ColdFusion pages and JSP pages, be careful about data type conversion issues. For
more information, see
"Java and ColdFusion data type
To share session variables, specify J2EE session management in the ColdFusion Administrator. For more information
on configuring and using J2EE Session scope management, see
page 312.
For example, you could put the customer order structure used in the previous example in the Session scope. Then, you
would not have to pass the order values as a set of parameters. Instead, the JSP pages could access the Session scope
variables directly, and the ColdFusion page would only require a line like the following to call the JSP page:
getPageContext().forward(URLEncodedFormat("/responsegen/responsegen.jsp"));
For examples of using the Request, Session, and Application scopes to share data between ColdFusion pages and JSP
pages, including samples of the appropriate JSP code, see
Note: When running in the server configuration, ColdFusion also shares the Form scope when calling a JSP or servlet. In
the J2EE configuration, however, sharing the Form scope is dependent on the J2EE application server. For example, JRun
shares the Form scope, IBM WebSphere does not. ColdFusion always shares the Request, Session, and Application scopes.
Unnamed ColdFusion Application and Session scopes
If you do not specify an application name in the This.name variable in the Application.cfc initialization code or by
using the ColdFusion cfapplication tag, the application is unnamed, and the Application scope corresponds to the
ColdFusion J2EE servlet context. ColdFusion, therefore, supports only a single unnamed application. If multiple
tags and Application.cfc files do not specify an application name, all pages in these applications share
cfapplication
the servlet context as their Application scope.
All sessions of unnamed applications correspond directly to the session object of the J2EE application server. (If you do
not use J2EE session variables, ColdFusion ensures that the J2EE session lasts at least as long as the session time-out.)
You access an Application scope variable from a ColdFusion unnamed application in a JSP page using the following
format:
application.getAttribute("applicationVariableName")
You access Session scope variables in a ColdFusion unnamed application as follows:
session.getAttribute("sessionVariableName")
Note: When you use application and session variables for the unnamed ColdFusion application in JSP pages and servlets,
the variable names must be case-correct. The characters in the variable name must have the same case as you used when
you created the variable in ColdFusion. You do not have to use case-correct application and session variable names for
named ColdFusion applications.
conversions" on page 1139.
"ColdFusion and J2EE session
"Examples: using JSP with
Last updated 8/5/2010
management" on
CFML" on page 1132.
1131

Advertisement

Table of Contents
loading

Table of Contents