Unfortunately it’s not quite as simple as being able to see each others
session or application variables in the same way. Request variables can
be seen as you would expect.

To put a variable into a ColdFusion session you have to do something
like this:

In your JSP/Servlet

(Map) session.getAttribute("yourCFApplicationName").put("foo","bar");

And then you can access it in a .cfm like this:

#session.foo#


Application variables are easier:

application.setAttribute("yourCFApplicationNam.foo","bar");

In you .cfm you access it like this:

#application.foo#


The key to remember is that it is all oriented around the application
name you defined for your ColdFusion app using <cfapplication>

I believe there is more comprehensive coverage in the cfdocs.

Regards,

André

-----Original Message-----
From: Steve [mailto:[EMAIL PROTECTED] 
Sent: 05 June 2003 15:07
To: CF-Talk
Subject: how to share servlet's session with Cold Fusion MX template?

Hello everyone,
 
I deployed ColdFusion MX as a web application to WebLogic7.0. 
I have a J2EE servlet that invokes a CFM page. This works. However, if I
try to set an attribute in the servlet's session, and try to pass that
session along to the CFM Page, in the CFM Page, it will NOT understand
that attribute. 

In the CFM page, i have

// test forwarding to cfm page.
String userArr[] = new String[1];

userArr[0] = "Wednesday";
HttpSession session = request.getSession(true);
session.setAttribute("sess", userArr);

getServletConfig().getServletContext().getRequestDispatcher
("/test/UserResultForm.cfm").forward(request, response);

And in the invoked CFM page, I cfdump the session info with this line,

<cfdump var=#session#>

I don't see "sess" as a valid attribute! in fact, when I try to access
it with

<!--- cfoutput> debug : #session.sess#</cfoutput --->

ColdFusion would throw an error saying sess is NOT defined.

In the Cold fusion Adminstrator, i have certainly turned on "Enable
Session Variables" and "Use J2EE session variables" flags and restarted
the server.  and in my application.cfm, I already have the following
attributes set, as follows,
 
<cfapplication name="form175" SESSIONMANAGEMENT="YES"
SESSIONTIMEOUT=#CREATETIMESPAN(0,0,30,0)#>

Thx a lot in advance for any suggestions/examples!

Steven




---------------------------------
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to