Problem retrieving Session variables in Flex from Coldfusion

For about a year I've been using a cfc that allows me to remote call from within Flex to retrieve session-level variables.  I much prefer this to using FlashVars because with the remote call the session values don't show up in the page source.
This was working fine when I was using an Application.cfm file to manage my Coldfusion pages.  However when I switched to using an Application.cfc file, the cfc stopped working.  Neither the cfc or the cfm file contain any code to manage these session variables (they are set in other pages), so the only real difference seems to be changing from Application.cfm to Application.cfc.
Any thoughts why?  Thanks.

Ok, this is resolved.
The problem seems to have been related to the scope of Application.cfc and Application.cfm.  The directory which contained the cfc files had an Application.cfm controlling the session, while the directory with the pages that included the flex swf files had an Application.cfc file.  Apparently these two don't talk to each other.
The solution is to use either Application.cfc or Application.cfm files, but not to mix them.  In other words, use either -- but be consistent.

Similar Messages

  • Accessing session variable in Flex.

    Hi All,
       I'm using RemoteObjects for accessing data and using Spring BlazeDS. How to retrieve 'session' variable values in Flex?
       Main application which is calling different .mxml files. It first invokes login(login.mxml) page with successful user credentials it will display home(home.mxml) page and I have search(search.mxml) pages.
        In case user session timeouts then I'd like to send user request to login page for login.(say user is in search page and where he left for 30 minutes, after then when user clicks anything on search page, it should redisplay login page because session timeout is set to (25 minutes).  How to do this Felx??
       Thanks in advance.
    Regards,
    Sharath.

    More detail solution will be found in the help.
    Look for the following string in your local help (in flex builder): Communicating with the Wrapper.
    You will probably find that you have to do something like the following:
    a) call from flex to the wrapper page javascript function.  (this would be a polling operation, run on a timer event (say) once every minute.
    b) the javascript function you call conducts an Ajax call to determine the current session state.
    Note that the above will likely keep your session state alive.
    Another possibility is to pass in the value of your session timeout via a FlashVars variable.
    Again, in a timer function run every minute, invcrement a local counter.
    When local counter equals session passed in, then you might assume that the session has timed out.
    IHTH.
    Cheers

  • How to retrieve sessions variables in JSP

    hi,
    I am trying to retrieve session variable from servlet to JSP.
    In the servlet i am retrieving employeenames from database and storing them in a ArrayList variable then i am setting this variable into the session.
    When retrieving the session in the jsp it displays as [empname1, empname2].
    Please help how to retrieve them
    Thanks in Advance,
    sha

    At the servlet:
    ArrayList<String> employeeNames = new ArrayList<String>();
    employeenames.add(blahBlahblah);
    session.setAttribute("eNames", employeeNames);
    At the JSP:
    ArrayList<String> names = (ArrayList<String>) session.getAttribute("eNames");
    for (String nom : names) {
    do something with the name stored in String variable nom...
    }

  • Problem accessing session variable from jsp

    Hi!
    I get an error retrieving a session variable from inside a JSP declaration scriptlet....
    Something like this code in a JSP page:
    <%!
    public void funtion1() {
    String parameter1 = session.getAttribute("parameter1");
    %>I have seen that I have available getContextServer() method and from there I could call getAttribute("parameter1") . But the thing is that the attribute I want to retrieve was stored in session by another Jsp page.
    Any solutions are welcome
    Cheers
    Victor

    Appropriately the above is one the reasons also You cannot use JSP implicit objects from the declaration tag. However we can think of a small workaround by passing the reference like the one discussed below
    <%!public void funtion1(HttpSession session) {
    String parameter1 = session.getAttribute("parameter1").toString();
    }%>
    <% funtion1(session);%>Hope that helps :)
    REGARDS,
    RaHuL

  • Purchased ColdFusion 10: Having problem with session variables

    My Dept. has just bought CF10 and I'm finally updating my existing web app to CF10 from CF8. My First Problem with CF10 is using session variables.
    When using the lower version of CF (since CF 4 to 8) I have never had any problem setting up session variables and getting or using these variables in other pages after a successful login but with CF 10 it seems setting session variables and using them in other pages are a major problems. I'm not sure where have I done wrong in the codes.
    First I'm setting the session in my Application.cfc This way:
    <cfcomponent displayname="Application" output="true">
      <cfset THIS.Name ="MyNewApp"/>
      <cfset THIS.ApplicationTimeout = CreateTimeSpan(0,0,20,0) />
      <cfset THIS.SessionManagement ="YES"/>
      <cfset THIS.SessionTimeout = CreateTimeSpan( 0, 0, 20, 0 ) />
      <cfset THIS.SetClientCookies = false />
    <cffunction name="OnApplicationStart" access="public" returntype="boolean" output="false">
    <cfset application.Main_DSN = "TESTDB">
    <cfreturn true />
    </cffunction>
    <cffunction name="onApplicationEnd" output="false">
          <cfargument name="applicationScope" required="true">
        </cffunction>
    <cffunction name="OnSessionStart" access="public" returntype="void" output="false" hint="Fires when user session initializes.">
    <cfset session.loggedin = "NO">
    <cfset session.username = "">
    <cfset session.userrights = "">
    <cfset session.usergroup = "">
    </cffunction>
    </cfcomponent>
    After login, user is validated and set values to those session.variables:
    ........user validation codes here......................
    <cfif mylogin NEQ true>
          <cflocation url="/login/login.cfm">
          <cfabort
    <cfelse>
          <cfset session.loggedin="Yes">
          <cfset session.username="#Trim(Form.username)#">
         <CFSET qUserRights = LoginObj.getUserRights('#Trim(Form.username)#')>
         <cfset session.userrights = qUserRights><!--- it's a query --->
        <CFSET qUserGroup = LoginObj.getUserGroup('#Trim(Form.username)#')>
            <cfloop query="qUserGroup">
               <cfset session.usergroup = user_group>
               <cfbreak>
            </cfloop>
        <!--- ****************** ???????????????????????????????????????????????????????????????????????????
        When I do cfdump in at this level, I can see that all of these session variables have been assigned to their values.
        But these session variables are not accessible from other pages. Other pages still show these session variable without its value.
        So, when I use these cfdumps in the index.cfm it is shown as they're not yet assigned with any values   ****************** --->
       <cfdump var="#session.loggedin#">
       <cfdump var="#session.username#">
       <cfdump var="#session.userright#">
       <cfdump var="#session.usergroup#">
    </cfif>
    In index.cfm, Before Login I got:
    session.loggedin = NO
    session.username = ["empty string"]
    session.userrights = ["empty string"]
    session.usergroup = ["empty string"]
    After a successful Login:
    session.loggedin = NO
    session.username = ["empty string"]
    session.userrights = ["empty string"]
    session.usergroup = ["empty string"]
    Have I done something wrong? These codes work on CF8. Please help.
    I need to mentioned:
    CF10 is in Linux and my web app is under https not http. But these session variables should be shared bentween http and https because some older application are still in http.

    On which page is the following code?
    After login, user is validated and set values to those session.variables:
    ........user validation codes here......................
    <cfif mylogin NEQ true>
          <cflocation url="/login/login.cfm">
          <cfabort
    <cfelse>
          <cfset session.loggedin="Yes">
          <cfset session.username="#Trim(Form.username)#">
         <CFSET qUserRights = LoginObj.getUserRights('#Trim(Form.username)#')>
         <cfset session.userrights = qUserRights><!--- it's a query --->
        <CFSET qUserGroup = LoginObj.getUserGroup('#Trim(Form.username)#')>
            <cfloop query="qUserGroup">
               <cfset session.usergroup = user_group>
               <cfbreak>
            </cfloop>
        <!--- ****************** ???????????????????????????????????????????????????????????????????????????
        When I do cfdump in at this level, I can see that all of these session variables have been assigned to their values.
        But these session variables are not accessible from other pages. Other pages still show these session variable without its value.
        So, when I use these cfdumps in the index.cfm it is shown as they're not yet assigned with any values   ****************** --->
       <cfdump var="#session.loggedin#">
       <cfdump var="#session.username#">
       <cfdump var="#session.userright#">
       <cfdump var="#session.usergroup#">
    </cfif>

  • Problems accessing session variables from a pop-up

    I am working on a webapp and I when I click on a certain button I need to have a pop-up appear that will either prompt a user to enter log-in info if they haven't already, otherwise the pop-up just needs to display a report. Users can navigate around on the main page and select various reports so multiple pop-ups could possibly be opened. When a user logs in I save the login info in session variables, but for some reason whenever I click to have another pop-up open it always says that my session variables are null. Is there a way to have more global session variables so that multiple windows (the pop-ups) can touch session variables? Would there be a way to pass the login info in session variables back to the main page and then pass those session variables back out to each pop-up that opens? Thanks so much.

    Have you got session cookies enabled?
    The most common way to keep track of the session id is via a session cookie.
    This cookie gets shared by all windows of the same browser session.
    You are opening these pop-up windows with window.open?
    Print out the session id <%= session.getId() %> on each page to see if it is the same.
    Cheers,
    evnafets

  • Problem with Session variable initialization block

    Hi,
    I'm getting strange results when using session variables in my repository files.
    I have created session variables as specified in the document which is available at
    http://www.oracle.com/technology/obe/obe_bi/bi_ee_1013/bi_admin/biadmin.html
    The main problem getting with the system session variable (USER) in the select statement.
    My select statement is as follows,
    select ':USER',case when upper(':USER') = 'KUMAR' then 'APR-05' end from Dual
    The problem is while logging into the BI Answers it is allowing all the invalid users to login who does not exist.
    when i remove the quotes and simply use :USER in the select statement it is not allowing the invalid users to login but giving error while displaying the results.
    when i remove the user variable from select statement its giving correct results.
    Can i know what is causing the problem.
    Thanks,
    Kumar.

    Hi DK,
    Check out my post Rowlevel Security?? and see if it helps you.
    Cheers!
    -Joe

  • Problem in session variables

    hi ,
    Is it not correct to assume that ones we close the browser the session losts and all the session variables also?
    Actually i have design an authentication page which takes userid and password from user and supply this to servlet which after authentication sets a variable "validity" in session to true.
    And in every other jsp page first i m checking this variableis true or not if not then i m redirecting it to authentication page with this tag
    <jsp:forward page="authentication.jsp" />
    now if i have authenticated correctly and close browser and try to access other pages directly then browser allows me to access any page and infact when i print "validity" variable from session then it prints true. That means even after closing the browsing session remains.
    I tried to print session id then after opening a new browser it is showing the same browser.
    In web.xml file i have mentioned the session time to 60 minutes . Is it because of this?. If it then how these standard sites sun, yahoo maintains session time out as well as browser dependent session.
    Right now what i have to do is before setting the variable i have reset the variable to null. But wher shud i reset the validity variable . in destroy method?
    manish

    Your problem is not due to session time out in the xml
    file.
    I think whenever you close your browser the session
    does not exists.
    Remember to invalidate the session while logging off.
    It should workThat is not true. The session will exist for as long as the session timout option is set. Although invalidating the session at logoff is a good idea, there is no real method to force people to log off when the leave your site/close the browser.
    There are a couple of possibilities why the session would still be used after a browser is closed, although normal behavior is to create a new one. The main reason is because the cookie on the browser that maintains the jsessionid is not destroyed. This often occurs in browsers like NS 7 with a "quick-load" app running in the taskbar area (next to the clock). These little parts of the application never close, and hold on to browser cache and cookies, so as to make it quicker to open and surf.
    How do you ge around this? I do not know, except perhaps by preventing the session from using cookies for tracking...

  • Problem passing Session variable as URL parameter?

    Hi,
    I am trying to create a multiple page entry form using
    coldfusion session. But I am having some problem when passing the
    session variable to url parameter. For test purpose I have created
    the following code:
    <cfif Not IsDefined("SESSION.AE")>
    <!--- If structure undefined, create/initialize it
    --->
    <cfset SESSION.AE = StructNew()>
    <!--- Represent current form srep; start at one --->
    <cfset SESSION.AE.StepNum = 1>
    </cfif>
    <cfif IsDefined("Form.GoBack")>
    <cfset SESSION.AE.StepNum = #url.StepNum# - 1>
    <cfelseif IsDefined("Form.Next")>
    <cfset SESSION.AE.StepNum = #url.StepNum# + 1>
    </cfif>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1">
    </head>
    <body>
    <form method="post"
    action="/AE/try.cfm?StepNum=#SESSION.AE.StepNum#">
    <input type="submit" name="GoBack" value="Back">
    <input type="submit" name="Next" value="Next">
    </form>
    </body>
    </html>
    When run it I get the following error:
    The value "" cannot be converted to a number
    The error occurred in C:\CFusionMX\wwwroot\AE\try.cfm: line
    11
    9 : <cfset SESSION.AE.StepNum = #url.StepNum# - 1>
    10 : <cfelseif IsDefined("Form.Next")>
    11 : <cfset SESSION.AE.StepNum = #url.StepNum# + 1>
    12 : <!---<cfset SESSION.AE.StepNum = #url.StepNum# +
    1>--->
    13 : </cfif>
    I couldn't figure out where is the problem. Any help is
    really appreciated.
    Thanks in advance.

    You are mixing up your gets and posts aren't you?
    You have your form method set to post which creates form
    variables not
    url variables. So when you try to use the url variable to set
    your
    session it does not exist.
    Change your SESSION.AE.StepNum = #url.StepNum# to
    Session.AE.StepNum =
    form.StepNum, note there is no need for the #'s.
    OR
    change your form method="post" to form method="get"
    Nagelia wrote:
    > Hi,
    >
    > I am trying to create a multiple page entry form using
    coldfusion session. But
    > I am having some problem when passing the session
    counter to url parameter. For
    > test purpose I have created the following code:
    >
    > <cfif Not IsDefined("SESSION.AE")>
    > <!--- If structure undefined, create/initialize it
    --->
    > <cfset SESSION.AE = StructNew()>
    > <!--- Represent current form srep; start at one
    --->
    > <cfset SESSION.AE.StepNum = 1>
    > </cfif>
    > <cfif IsDefined("Form.GoBack")>
    > <cfset SESSION.AE.StepNum = #url.StepNum# - 1>
    > <cfelseif IsDefined("Form.Next")>
    > <cfset SESSION.AE.StepNum = #url.StepNum# + 1>
    > </cfif>
    >
    > <html>
    > <head>
    > <title>Untitled Document</title>
    > <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1">
    > </head>
    > <body>
    > <form method="post"
    action="/AE/try.cfm?StepNum=#SESSION.AE.StepNum#">
    > <input type="submit" name="GoBack" value="Back">
    > <input type="submit" name="Next" value="Next">
    > </form>
    > </body>
    > </html>
    >
    > When run it I get the following error:
    >
    > The value "" cannot be converted to a number
    >
    >
    > The error occurred in C:\CFusionMX\wwwroot\AE\try.cfm:
    line 11
    >
    > 9 : <cfset SESSION.AE.StepNum = #url.StepNum# - 1>
    > 10 : <cfelseif IsDefined("Form.Next")>
    > 11 : <cfset SESSION.AE.StepNum = #url.StepNum# +
    1>
    > 12 : <!---<cfset SESSION.AE.StepNum =
    #url.StepNum# + 1>--->
    > 13 : </cfif>
    >
    > I couldn't figure out where is the problem. Any help is
    really appreciated.
    >
    > Thanks in advance.
    >
    >
    >
    >

  • Using session variables in Flex 2

    I'm not sure if this is the correct place for this
    topic...but the Flex 2 upgrade/migration forum didn't seem too
    lively. So let me set up my situation and then pose the question.
    In Flex 1.5, I accessed the session servlet using:
    <mx:RemoteObject source="servlet" id="servlet"/>
    This allowed me to store session variables such as a user
    object:
    var u:User = new User();
    servlet.session("set", "user", u);
    This allowed me to access these variables from another Flex
    app:
    var user:User;
    servlet.session("get", "user");
    How would I go about doing this in Flex 2.0? Thanks to those
    who can help.

    That almost works. I had to adjust the syntax to the following...and then there are other issues doing this.
    select cust_no, name,'@{session.currentUser}' from customersMy write-back SQL is this:
    UPDATE customers SET NAME='@{c1}',LAST_EDITED_BY='@{c2}' WHERE CUST_NO=@{c0}But I don't want to display the cust_no column to the user. So I hide it in the UI. But if I do that I get the below error during write-back. Apparently sometimes when you hide a column on a direct query (numeric maybe?) the value doesn't transfer over to the write-back. If that's the case, this won't work for me. Hmm...
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43093] An error occurred while processing the EXECUTE PHYSICAL statement. [nQSError: 17001] Oracle Error code: 936, message: ORA-00936: missing expression at OCI call OCIStmtExecute: UPDATE customers SET NAME='Wyatt Donnely',LAST_EDITED_BY='Administrator' WHERE CUST_NO= . [nQSError: 17011] SQL statement execution failed. (HY000)
    SQL Issued: EXECUTE PHYSICAL CONNECTION POOL dev1 UPDATE customers SET NAME='Wyatt Donnely',LAST_EDITED_BY='Administrator' WHERE CUST_NO=

  • Problem with session variable

    Hi,
    After I insert a record into my MS Access database, it seems
    to me that the session variable got destroyed so the next page
    display the session variable as undefined. Has anyone have similar
    problem? If so, how to work around that?
    Thanks.
    Tommy,

    neptunes wrote:
    but its leading to jsp page error...For starters: never, never, ignore errors (exceptions and stacktraces). Those contain very, very, worthful information about the cause of the problem and what exactly went wrong. This way you can easily trackback the problem and solve it.
    If you're unable to think logically and smart so that you can interpret the error yourself, if necessary with help of Google, then post it here. Then we'll tell you about the actual problem and possible soltions.
    At any way:
    iam displaying some data in a table using resultset object,now at the same time iam using to session variable to use the resultset object in my other applications...This already doesn't sound very good. You should never pass expensive resources around like that. You should acquire and close the Connection, (Prepared)Statement and ResultSet in the shortest possible scope. Preferably already in the same method as where you query the data.

  • Problem accessing session variables in JSP

              Hi all,
              i am retrieving the value of session variables in a JSP page. the session varibale
              is set at the
              server side. sometimes the jsp is able to retrieve the value and sometimes it
              doesn't.
              Thanks & Regards
              Tarun
              

    if getAttribute return null so there is no such session attribute,anyway
              check your browser if cookies are enabled.
              "Tarun Mangal" <[email protected]> wrote in message
              news:400759e9$[email protected]..
              >
              > Hi all,
              > i am retrieving the value of session variables in a JSP page. the session
              varibale
              > is set at the
              > server side. sometimes the jsp is able to retrieve the value and sometimes
              it
              > doesn't.
              >
              > Thanks & Regards
              > Tarun
              

  • Setting & Retrieving Session Variables

    Hi,
    I’m new at session variables and having trouble
    understanding the basics.
    I have a form with two dropdowns. I want to store the
    selections from both in session variables. Then pass those to
    another page where I want to display the selected values in my
    headline such as “You searched for [value1] and [value2]." I
    can’t get this to work right. I’ve gone through DW Help
    and tutorials and still can’t figure it out.
    Any help would be much appreciated.
    DW CS3, ASP and Access
    Thanks,

    > I?m new at session variables and having trouble
    understanding the basics.
    >
    > I have a form with two dropdowns. I want to store the
    selections from both
    > in
    > session variables. Then pass those to another page where
    I want to display
    > the
    > selected values in my headline such as ?You searched for
    [value1] and
    > [value2]." I can?t get this to work right. I?ve gone
    through DW Help and
    > tutorials and still can?t figure it out.
    >
    > Any help would be much appreciated.
    >
    > DW CS3, ASP and Access
    On your form action page, put this in:
    <%
    Session("varOne") = Request.Form("dropdown1")
    Session("varTwo") = Request.Form("dropdown2")
    %>
    To write the sessions to the page, put this:
    You searched for <%=varOne%> and <%=varTwo%>.

  • Use SESSION variable in URL from HTML region

    Hello,
    I have what looks like a simple question but i've been struggling with it for three days now, and i need your help!
    I have a page, with an HTML region. I want to display some links to other pages within the application, so i thought i'd use this:
    a href="http://server.xxxx.com:7777/pls/htmldb/f?p=114:13:&SESSION"
    But the session ID is not interpreted, and the link doesn;t work. Any idea what's wrong here? or how i should create links with the session id in it?
    Thanks!!!! Matt
    Message was edited by:
    matt_amsterdam

    Matt,
    You've missed off the period (.) off the end, use &SESSION. instead

  • Use of session variable to retrieve user language

    Hi,
    I'm converting some ASP code to JSP and I'm having a problem concerning session variables, in ASP I had something like this
    (first.asp)
    <td align="center" width=145px><%=getLabel(1)%>
    and in second.asp
    dim Label(3,2)
    function GetLabel(ndx)
    GetLabel = Label(ndx, Session("Language"))
    end function
    clang_PT = 1 ' Portuguese
    clang_EN = 2 ' English
    Label(0,clang_PT) = "primeira"
    Label(1,clang_PT) = "Segunda"
    Label(0,clang_PT) = "first"
    Label(1,clang_PT) = "second"
    when trying to do the same thing in JSP
    (first.jsp)
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@include file="labels.jsp"%>
    <!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
    <%if (session.isNew()) {
    session.setAttribute("Language","1");
    }%>
    <%= getLabel(1)%>
    (labels.jsp)
    <%@ page language="java" import="java.util.*"%>
    <%@page pageEncoding="UTF-8"%>
    <%! String getlabel(int ndx){
    return label[ndx][session.getAttribute("Language")];
    String[][] label = new String[2][2];
    %>
    <%
    int clang_PT = 0; // Portugu�s
    int clang_EN = 1; // Ingl�s
    label[0][clang_PT] = "primeira";
    label[1][clang_PT] = "segunda";
    label[0][clang_EN] = "first";
    label[1][clang_EN] = "second";
    %>
    I get
    cannot find symbol symbol : variable session location: class org.apache.jsp.experiencia_jsp return label[ndx][session.getAttribute("Language")];
    ^
    and
    cannot find symbol : method getLabel(int)
    location: class org.apache.jsp.experiencia_jsp
    out.print( getLabel(1));
    Should I use a bean to store this kind of info?
    thanks, V

    right...
    actually, cuz doing this:
    <%!
    String getlabel(int ndx){
    int lang = Integer.parseInt((String)session.getAttribute("Language"));
    return label[ndx][lang];
    %>
    there's no session object... that creates a method in the class separate from the main JSP method. So you need to either pass the session object in, or just pass the attribute value..
    <%!
    String getlabel(int ndx, int lang){
    return label[ndx][lang];
    %>
    int lang = Integer.parseInt((String)session.getAttribute("Language"));
    String lable = getLabel(ndx, lang);

Maybe you are looking for

  • User exits/BAdIs for Forecast consumption by sales order

    Hello Experts, My question here is: When Sales Order either new or change comes from ECC to APO, what are key fields considered for Forecast Consumption? Is requirements strategy is considered from location product master or Sales Order brings own da

  • Request Dispatcher error when forwarding

    hi all, I am using tomcat 4.1.24 and jdk1.3.1. I am having one servlet and one jsp. Servlet handles the submitted form and then for presentation logic it sends request to jsp page. I have servlet mapping properly defined in the web.xml and servlet ur

  • No Sound on the internet ( Safari) !!

    Everything else plays find but when I'm on the internet all the websites have no sound. Some please help me...

  • Error message when connecting device to itunes

    HELP ME get my ipad on PLEASE!!

  • Adobe not working with window 7 ?

    My new Dell computer with window 7 & adobe reader x installed, but when I try to read an PDF file, msg come up " adobe reader has stopped working, a problem caused the program to stop working correctly", then it closed itself. Try to uninstall adobe