Read a session variable

I have set a session variable "var1" in the pagedef using ADFUtil.setEL("#(sessionScope.var1)",myValue);
How do I read this session variable, "var1" in select statement in a View Object please?
Thanks

Do NOT try to access the variables stored in a scope in a view controller project directly in the Model layer. It breaks the MVC paradigm.
For your use-case,
1) Create a View Object with a View Criteria that has a single bind variable.
2) Have a method in AMImpl that takes a single parameter and applies the View criteria for the View Object Instance in 1) by setting the value for the bind variable with the input parameter and execute the View Object and expose this method through client interface.
3) Use this method in ViewController project and Invoke the method.
Thanks,
Navaneeth

Similar Messages

  • Reading ASP Session Variables in CF

    We have an old ASP application that we would like to
    integrate some CF Reporting reports into. There are a couple of
    seession variables stored in ASP that I would like to get. Is there
    a way/workaround to reading these variables into CF?
    Thanks,
    James

    > I thought that was going to be the case... I was just
    worried about user's saving shortcuts to URL variabled pages...
    This will get me started... Thanks.
    What about writing a gateway web service for passing session
    info between
    application server platforms (I've not tried this sort of
    thing between CF
    and ASP, but have done so CF->CF and it worked OK)? This
    would be a bit
    more foolproof than using form submissions or URLs.
    Adam

  • Reading a session variable from a dynamic action

    I have a select list on a page and a button next to the select list. The button calls a dynamic action which opens a page and sends the value in the select list. The page is not submitted. The DA has a step with a dummy PL/SQL block that submits the select list item. Then the page is called with the select list in the URL.
    The value is not being sent. If I go into edit mode then run the page again then the correct value is sent.
    When I look at session in Administration the select list is in session and set properly but is not sent unless the page is submitted.
    Why if it is in session is it not being passed correctly? What does submitting the page do other than update session?

    Hi,
    could you share the exception trace ?
    Frank

  • Unable to fetch session variables in my application page code behind

    hi,
    my env:  1  WFE  server which hosts the  central admin and my web appln,  1 sql server box  
    i am having a custom web part[ listviewbyquery web part]  which populates the site collection/ sub site's document library contents . also it reads some query string values and pushes these  values into  session variables.
    and i am having another application page in this application which reads this session variables and  perform some operation in a custom sql db. But i am unable to read these session variables on page load of this  application page.
    am unable to debug also. so, would like to know is there any way i can see, what values  are getting passed to this page and verify the session variables are accessed correctly.
    or
    is this  by design, that its not possible to read session variables in the application page ?
    if i am not having a visual studio env. to debug, how to test these  session variable  existence / to find the root cause of this issue.
    note: already configured session state in IIS , http  modules section. am using Page.Session["myvariable1"].tostring() to fetch the  session variables.
    help is appreciated!

    i have found out myself. i have put  page.response.write(mysessionvariables) in the code and deployed and tested in my env. and i was able to find out the reason and i have fixed it with proper validation check.

  • Session Variables Disappearing

    This issue of disappearing session variables keeps coming up
    again and again. I am reading about session variables work from
    Adobe site and it say this
    Click
    Here
    Session variables have the following
    traits:
    In order for session variables to
    work, the visitor's browser must be set to accept cookies.
    The pages for
    the site all must be located within a single directory on the web
    server.
    Information stored in session
    variables is site visitor specific. Different site visitors cannot
    access each other's session variable information.
    My question is this (about the highlighted). since my
    application.cfm is located in the root directory and the session
    variables are set from different directories under the root, will
    this be the problem? Users login into the site from the members
    directory and the sessions for that user are set after successful
    login. when the user tries any other link from a different
    directory the session disappears. Is this a recurring problem with
    CFMX (6.1)or am I the only one experiencing this. I wish someone
    from ADOBE should also respond to this.

    The session variables are good for the entire application.
    And the application is defined as any file at the same level or
    beneath the application.cfm. If you are trying to access files that
    do not fall under or at the same level as application.cfm then your
    session variables would be invalid.

  • Reading Session Variables in Abstract Portal Component/ JSP Dynpage or Java

    Hi All,
    I have a web dynpro for Java component which passes parameters in a session and also navigates to a Java application.
    Now when I try to read the session parameters in the Java application (JSPDynpage or Abstract Portal Component) I cannot retrieve the values.
    Can someone throw light on how I can achieve this within a Java application.
    Code is as enclosed below -
    WD for Java Code
      public void onActionClicked(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionClicked(ServerEvent)
    IClientSession session = Utils.getCurrentClientSession();
    IScope scope = session.getScope();
    scope.put("TestSession", wdContext.currentContextElement().getTxtValue());
    WDPortalNavigation.navigateAbsolute(
    "ROLES:portal_content/com.be.pct.cr.Test/DynProToNet",
    WDPortalNavigationMode.SHOW_INPLACE,
    (String)null,
    (String)null,
    WDPortalNavigationHistoryMode.NO_DUPLICATIONS,
    (String)null,
    (String)null,
    (String)null);
        //@@end
    Code within the Abstract Portal Component doContent method is -
    IPortalComponentSession ses;          
    ses = request.getComponentSession();
    String TestSession = new String();
    String sTest = new String();
    String sTesting = new String();
    if(ses.getValue("TestSession")!= null){
    TestSession = ses.getValue("TestSession").toString();
    if(request.getParameter("TestSession")!= null){
    sTest = request.getParameter("TestSession");
    if( request.getValue("TestSession")!= null)
    sTesting = request.getValue("TestSession").toString();
    response.write("Display"TestSessionsTest+sTesting);
    Any help is highly appreciated.
    Thanks in advance,
    Divya

    Hi,
      Why not use eventing between webdynpro and portal applications? That would be more easy. Check these documents.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/60d7d690-0201-0010-e581-9c4fc69cec0e
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d48eaa90-0201-0010-58a8-887fc8632c3c
    Regards,
    Harini S

  • To pass new session variable value to stored proc before running a report.

    Hi,
    Below is summary of the report requirement -
    Database level design
    1. Created a view and a global temporary table (GTT)
    2. Created an Oracle package procedure to accept from and to business dates on basis of which it will fetch, process and populate the GTT.
    Repository level design
    1. Created a business model containing the view and the GTT (mentioned above)
    2. Created two SESSION variables "from_dt" and "to_dt" to be initialized by their respective init blocks. Each of the variable is initialized with a DATE column value (of type DATETIME) from a database lookup table. I have also set the option "Enable that variable to be set by any user" for both variables.
    Query for these variables :
    from_dt = select from_date from <table>
    to_dt = select add_months(from_date,12) from <table>
    Presentation level design
    1. Using a text box, i display the default/initialized values of these variables like this -
    Current business date:@{biServer.variables['NQ_SESSION.from_dt']} Future business dt:@{biServer.variables['NQ_SESSION.to_dt']}
    Dates get displayed in YYYY-MM-DD 00:00:00 format
    The text msg displays these default dates and allows the user to specift different date range for which i create prompts as shown below.
    2. Using any random two columns of date type from the business model, i create two date dashboard prompts with labels "From Dt" and "To Dt".
    i select Calender Controls for both; setting Default To = Report Defaults.
    The Set Variable is set to Presentation variables - such that pv_from_dt maps to "From Dt" and pv_to_dt maps to "To Dt".
    3. i create the report using the business model created above. In the report "Advanced Tab" => "Prefix" field i specify the following -
    SET VARIABLE from_dt='@{pv_from_dt}',to_dt='@{pv_to_dt}';
    Note : The logic here is to display the default dates and allow user to specify different date values which will be stored in presentation variables.
    If the user does specify different "from dt" and "to dt" values, then using the presentation variables, i want to "write" back these new values to the corresponding session variables mentioned above.
    If the user does not specify different date range, then the default/initialized dates must be considered.
    I also display the default and new date values in the report title.
    Back to Repository level design
    To execute the stored procedure that will load the GTT before running the report I need to pass two date parameters to the stored procedure on basis of which it will fetch data, process and populate the GTT.
    In the Connection Pool --> Connection Script Tab --> Execute before query, I wrote the below query using the repository variables FROM_DT and TO_DT to execute the procedure -
    DECLARE
    v_from_dt date;
    v_to_dt date;
    BEGIN
    v_from_dt := VALUEOF(From_Dt);
    v_to_dt := VALUEOF(To_Dt);
    package_name1.package_body(v_from_dt,v_to_dt);
    END;
    Now when i try to run the report i get the following error :
    [nQSError: 10058] A general error has occurred. [nQSError: 23006] The session variable, NQ_SESSION.to_dt, has no value definition. (HY000)..
    Need help on this.
    Is it possible to "write back" a new value to a session variable ?
    Any other alternatives.
    Thanks
    Nusrat
    Edited by: user10309945 on Jan 24, 2011 10:08 PM

    Sandeep, I found a several topics where users describe saving values in DB through stored procedure or function. For example, [How to store OBIEE presentation level variable values in DB |http://forums.oracle.com/forums/thread.jspa?threadID=892006] I tried it and get an error
    *10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 14551, message: ORA-14551: cannot perform a DML operation inside a query ORA-06512*
    It's not a BI error. This error are generated by Oracle DB. If I write next:
    SELECT MyPLSQLFunction(p1,p2) FROM DUAL
    I get the same error.
    Oracle doesn't allow DML operations in SELECT.
    Did you relalize this feature yourself? Where did I mistake?

  • Session variable size limitation (LV Webservices)

    Hi community,
    I read couple dozen email addresses from an XML and trying to write them into a session variable. The email addresses are comma separated and have a total string length of about 1100 characters. When I try to write it into a session variable LabVIEW drops an error message (-67158).
    It is very clearly related to the size of the string as if use lets say only 200 characters I dont receive the error message.
    How can I get rid of this limitation?
    Thanks!

    I am writing a general purpose webpage where I need email notifications. I have the workaround ready (before I send out the emails I dont read the emails from a session, but using the userID stored in the session to read the email from the xml). But generally having this limitation is annoying and unnecessary as normally you easily can store 100kB in one session. (probably even more, but that was the max I have ever did)

  • Trying to move a list of form variables to session variables of the same name

    I am trying to move a list of form variables to session variables of the same name and I am having a lot of trouble.
    I have never had to post of this forum with a language question in all the 10 years I have been using ColdFusion. I was a qa Engineer @ Allaire/Macromedia back when it was going from one to the other. I have a pretty good grasp of the language.
    I have software that runs off a list. The fieldnames are variable and stored off in an array. It's survey software that runs off a "meta file". In this example; I have the number of fields in the survey set to 12 in the "metafile". I have each field declared in that file in array Session.SurveyField[1] and the above loop works fine. I include this "metafile" at the start of the process.
    I cfloop around a struct and it works wherever I have needed to use it; such as here - writing to the database for example;
    <CFQUERY NAME="InsertRec" DATASOURCE="Survey">
    INSERT into #variables.SurveyTableName#
    (EntryTime
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    ,#Session.SurveyField[arrayindex]#
    </cfloop>
    <!--- EXAMPLE OF WHAT THE ABOVE GENERATES
    ,q01_name,q02_AcadTechORNA,q03_Water,q04_FirstAid,q05_CPR,q06_LifeGuard,q07_AED
    ,q08_ProjAdv,q09_Color,q10_SantaClaus,q11_Supervisor,q12_SupervisorOpinion --->
       VALUES
        ('#EntryTime#'
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    <cfset thisname = "Session." & Session.SurveyField[arrayindex]>
    ,'#evaluate(variables.thisname)#'
    </cfloop>
    <!--- EXAMPLE OF WHAT THE ABOVE GENERATES
    ,'#Session.q01_name#','#Session.q02_AcadTechORNA#','#Session.q03_Water#','#Session.q04_Fi rstAid#'
    ,'#Session.q05_CPR#','#Session.q06_LifeGuard#','#Session.q07_AED#','#Session.q08_ProjAdv# ',
    ,'#Session.q09_Color#','#Session.q10_SantaClaus#','#Session.q11_Supervisor#','#Session.q1 2_SupervisorOpinion#' --->
    </CFQUERY>
    NOW HERE'S THE PROBLEM: I am running into trouble when trying to move the form variables to session variables of the same name. It is the only part of the software that I still need the datanames hard coded and that is a roadblock for me.
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    <cfset thissessionfield = "Session." & Session.SurveyField[arrayindex]>
    <cfset thisformfield = "Form." & Session.SurveyField[arrayindex]>
    <cfset #thissessionfield# = #evaluate(thisformfield)#>
    </cfloop>
    I have tried it with or without the "evaluate"; same result. It doesn't give an error; it just ignores them (session variables look as such in the next page in the chain)
    q01_name=
    q02_acadtechorna=
    q03_water=
    q04_firstaid=
    q05_cpr=
    q06_lifeguard=
    q07_aed=
    q08_projadv=
    q09_color=
    q10_santaclaus=
    q11_supervisor=
    q12_supervisoropinion=
    Note: they exist because I CFPARAM them in a loop like the above at the start of the procedure) - and this works just fine!
    <cflock scope="Session" type="EXCLUSIVE" timeout="30">
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    <cfset dataname = "Session." & Session.SurveyField[arrayindex]>
    <cfparam name="#variables.dataname#" default="">
    </cfloop>
    </cflock>
    I EVEN tried exploiting the Form.Fieldnames list using CFLoop over the list and the same sort of logic within and it still gives me nothing....
    Here's the FORM.FIELDNAMES value
    "Q01_NAME,Q02_ACADTECHORNA,Q03_WATER,Q04_FIRSTAID,Q05_CPR,Q06_LIFEGUARD,Q07_AED,Q08_PROJAD V,Q09_COLOR,
    Q10_SANTACLAUS,Q11_SUPERVISOR,Q12_SUPERVISOROPINION"
    Here's the logic; SAME RESULT - The session variables don't get set.
    <cfoutput>
    <cfloop list="#Form.FieldNames#" index="thisfield">
    <!--- <br>#thisfield# --->
    <cfscript>
    thisSESSIONfield = "Session." & thisfield;
    thisFORMfield = "Form." & thisfield;
    #thisSESSIONfield# = #thisFORMfield#;
    </cfscript>
    </cfloop>
    </cfoutput>
    The CFPARAM in a loop with variable output name works just fine; so does the post (which I included above) as does the SQL Create, Param Form Variables, Param Session Variables, etc.
    THIS even works for moving BLANK to each session variable, to zero them all out at the end of the process;
    <cflock scope="Session" type="EXCLUSIVE" timeout="30">
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    <cfset thislocalfield = Session.SurveyField[arrayindex]>
    <cfscript>
    thissessionfield = "Session." & thislocalfield;
    </cfscript>
    <cfset #thissessionfield# = "">
    </cfloop>
    </cflock>
    Expanding on that code, you would think this would work, but it doesn't;
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
    <cfset thislocalfield = Session.SurveyField[arrayindex]>
    <cfscript>
    thissessionfield = "Session." & thislocalfield;
    thisformfield = "Form." & thislocalfield;
    </cfscript>
    <!--- debug --->
    <!--- <cfoutput>#thissessionfield# = "#evaluate(thisformfield)#"</cfoutput><br> --->
    <cfoutput>
    <cfset #thissessionfield# = "#evaluate(thisformfield)#">
    </cfoutput>
    </cfloop>
    And see that debug code in the middle? To add insult to injury... When I uncomment that it shows me this. So it certainly looks like this should work....
    Session.q01_name = "Me"
    Session.q02_AcadTechORNA = "N/A"
    Session.q03_Water = "Yes (certificate expired)"
    Session.q04_FirstAid = "Yes (certificate is current)"
    Session.q05_CPR = "No"
    Session.q06_LifeGuard = "Yes (certificate expired)"
    Session.q07_AED = "Yes (certificate expired)"
    Session.q08_ProjAdv = "Yes (certificate expired)"
    Session.q09_Color = "Gray"
    Session.q10_SantaClaus = "Yes"
    Session.q11_Supervisor = "Da Boss"
    Session.q12_SupervisorOpinion = "Not a bad thing"
    There must be some simpler way to do this. This way won't work against all odds even though it seems so much like it should.
    So I end up having to hardcode it; still looking for an automated way to set these #@%$*@!## session variables over the list from the form variables of the same @#@!$#%$%# name. Do I sound frustrated???
    No matter what I do, if I don't HARDCODE like this;
    <cfset Session.q01_name = Form.q01_name>
    <cfset Session.q02_AcadTechORNA = Form.q02_AcadTechORNA>
    <cfset Session.q03_Water = Form.q03_Water>
    <cfset Session.q04_FirstAid = Form.q04_FirstAid>
    <cfset Session.q05_CPR = Form.q05_CPR>
    <cfset Session.q06_LifeGuard = Form.q06_LifeGuard>
    <cfset Session.q07_AED = Form.q07_AED>
    <cfset Session.q08_ProjAdv = Form.q08_ProjAdv>
    <cfset Session.q09_Color = Form.q09_Color>
    <cfset Session.q10_SantaClaus = Form.q10_SantaClaus>
    <cfset Session.q11_Supervisor = Form.q11_Supervisor>
    <cfset Session.q12_SupervisorOpinion = Form.q12_SupervisorOpinion>
    I always get this from my next page because the session variables are empty;
    You must answer question 1.
    You must answer question 2.
    You must answer question 3.
    You must answer question 4.
    You must answer question 5.
    You must answer question 6.
    You must answer question 7.
    You must answer question 8.
    You must answer question 9.
    You must answer question 10.
    I tried duplicate as well, but I can not get the above to work...
    Can anyone help me do this thing that one would think is simple????

    I think if you use structure array syntax you should get the results you want.
    <cfloop from="1" to="#Session.NumberOfSurveyFields#" index="arrayindex">
          <cfset session[Session.SurveyField[arrayindex]] = Form[Session.SurveyField[arrayindex]]>
    </cfloop>
    Or probably even easier.
    <cfset session = duplicate(form)>

  • Compare data record to session variable

    I am completely stumped. It should be easy.
    I am trying to compare a field from a database to a sesssion variable on a JSP page and even though the fields print out the same when I call them in JSP, my "If" statement never gets activated.
    Here's the last version of the code I tried:
    String usernamev = UserSession.getValue("username").toString();
    String custname = RS.getString("ORCUST");
    if (usernamev.equals(custname))
    userrole="Customer ";
    I've also tried this:
    String usernamev = UserSession.getValue("username").toString();
    String custname = RS.getString("ORCUST").toString;
    if (usernamev.equals(custname))
    userrole="Customer ";
    And I've also tried this:
    if (RS.getString("ORCUST").equals(usernamev))
    userrole= "Customer ";
    And This:
    And I've also tried this:
    if (usernamev.equals(RS.getString("ORCUST")))
    userrole= "Customer ";
    When RILLI is the field I'm trying to compare this works:
    if (usernamev.equals("RILLI"))
    userrole= "Customer ";
    Somehow my data type must be wrong but I can't figure out why. When I print out
    <%=usernamev%>
    and <%=RS.getString("ORCUST")%>
    they show on my webpage as RILLI. I can also assign a constant value to userrole without a problem.
    What the heck am I doing wrong?

    I think limeybrit was on the right track and I hadn't trimmed because I got a no trim method error before because I hadn't converted session variable to a string.
    When I used this:
    String usernamev = UserSession.getValue("username").toString();
    usernamev = usernamev.trim();
    String custname = RS.getString("ORCUST").trim();
    I think its working now. Thanks for help all.

  • Session variable getting reset when leaving dashboard

    I have created a session variable with the 'Enable any user to set the value' option.  I'm using the session variable as the default for a dashboard prompt.  I'm able to set the variable with that  dasboard prompt, and I can confirm that it is indeed getting set properly.  So the interaction of the variable and the prompt seems to be in order.
    After I make a selection from the dashboard prompt, as long as I stay in the dashboard, the session variable stays set to my selection.  I can move from page to page and everything is fine.  The selection stays put as I have set it.  However, the moment I leave the dashboard, the session variable is reinitialized back to its default value as specified by the SQL in its initialization block.  I can go from dashboard to catalog and back to dashboard - boom, it's back to the default.  My selection has been replaced.  ???
    And here's an odd thing:  I can look in the query log and see the initialization block code getting run when I log in.  So far, so good.  I can run the dashboard, make a prompt selection, and see the query log updated just fine.  Still OK.  BUT... when I switch from dashboard to catalog and back to dashboard, the value of the session variable is reset (I see the default month in my analysis and as the prompt default upon redisplay of the dashboard page), but there's no indication in the query log that the initialization block SQL ran again.  The last SQL in the query log still shows my "selected" value in the SQL.  The dashboard page is showing the "default", while the last entry in the query log shows the "selected".
    Can anyone else confirm this odd behavior?  And is there a reason that a session variable should not retain its value throughout the session?  I've always viewed session variables as little buckets of single-cell data whose contents are consistent and static for the duration of a session, unless manually changed by a dashboard prompt.  If the behavior that I'm seeing is both replicatable and expected, it would appear that my understanding is flawed.
    Running 11.1.1.7.0 on Windows Server 2008.  Same behavior is occurring in both Firefox 21 and IE 9.

    Thank you for your answer MK,
    I try to write a SQL in my prompt but not work for me:
    -In default selection I choose SQL Results and I type: Year(Current_date) and save my prompt and I don't see any value in my dashboardpage, if I click in prompt I can see all members of my year dimension but by default is empty.
    I modify the other solution: I have 1hour refresh time and I change for 1 minute, but doesn't work.
    the default initializer is in RPD (variable year that belongs to BI_Year Block) and I have written 2009.

  • Javacard and session variables

    Hello,
    I'm trying to find a reasonable Javacard technique to handle "session variables" that must be kept between successive APDUs, but must be re-initialized on each card reset (and/or each time the application is selected); e.g. currently selected file, currently selected record, current session key, has the user PIN been verified...
    Such variables are best held in RAM, since changing permanent (EEPROM or Flash) variables is so slow (and in the long run limiting the operational life of the card).
    Examples in the Java Card Kit 2.2.2 (e.g. JavaPurseCrypto.java) manipulate session variables in the following way:
    1) The programmers group session variables of basic type (Short, Byte, Boolean) according to type, and map each such variable at an explicit index of a vector (one per basic type used as session variable).
    2) At install() time, each such vector, and each vector session variable, is explicitly allocated as a transient object, and this object is stored in a field of the application (in permanent memory), where it remains across resets.
    3) Each use of a session variable of basic type is explicitly translated by the programmer into using the appropriately numbered element of the appropriate vector.
    4) Vector session variables require no further syntactic juggling, but eat up an object descriptor worth of permanent data memory (EEPROM or Flash), and a function call + object affectation worth of applet-storage memory (EEPROM, Flash or ROM).
    The preparatory phase goes:
    public class MyApp extends Applet  {
    // transientShorts array indices
        final static byte       TN_IX = 0;
        final static byte       NEW_BALANCE_IX=(byte)TN_IX+1;
        final static byte      CURRENT_BALANCE_IX=(byte)NEW_BALANCE_IX+1;
        final static byte      AMOUNT_IX=(byte)CURRENT_BALANCE_IX+1;
        final static byte   TRANSACTION_TYPE_IX=(byte)AMOUNT_IX+1;
        final static byte     SELECTED_FILE_IX=(byte)TRANSACTION_TYPE_IX+1;
        final static byte   NUM_TRANSIENT_SHORTS=(byte)SELECTED_FILE_IX+1;
    // transientBools array indices
        final static byte       TRANSACTION_INITIALIZED=0;
        final static byte       UPDATE_INITIALIZED=(byte)TRANSACTION_INITIALIZED+1;
        final static byte   NUM_TRANSIENT_BOOLS=(byte)UPDATE_INITIALIZED+1;
    // remanent variables holding reference for transient variables
        private short[]     transientShorts;
        private boolean[]   transientBools;
        private byte[]      CAD_ID_array;
        private byte[]      byteArray8;  // Signature work array
    // install method
        public static void install( byte[] bArray, short bOffset, byte bLength ) {
             //Create transient objects.
            transientShorts = JCSystem.makeTransientShortArray( NUM_TRANSIENT_SHORTS,
                JCSystem.CLEAR_ON_DESELECT);
            transientBools = JCSystem.makeTransientBooleanArray( NUM_TRANSIENT_BOOLS,
                JCSystem.CLEAR_ON_DESELECT);
            CAD_ID_array = JCSystem.makeTransientByteArray( (short)4,
                JCSystem.CLEAR_ON_DESELECT);
            byteArray8 = JCSystem.makeTransientByteArray( (short)8,
                JCSystem.CLEAR_ON_DESELECT);
    (..)and when it's time for usage, things go:
        if (transientShorts[SELECTED_FILE_IX] == (short)0)
            transientShorts[SELECTED_FILE_IX] == fid;
        transientBools[UPDATE_INITIALIZED] =
            sig.verify(MAC_buffer, (short)0, (short)10,
                byteArray8, START, SIGNATURE_LENGTH);I find this
    a) Verbose and complex.
    b) Error-prone: there is nothing to prevent the accidental use of transientShorts[UPDATE_INITIALIZED].
    c) Wastefull of memory: each use of a basic-type state variable wastes some code; each vector state variable wastes an object-descriptor worth of permanent data memory, and code for its allocation.
    d) Slow at runtime: each use of a "session variable", especially of a basic type, goes thru method invocation(s) which end up painfully slow (at least on some cards), to the point that for repeated uses, one often attain a nice speedup by caching a session variable, and/or transientShorts and the like, into local variables.
    As an aside, I don't get if the true allocation of RAM occurs at install time (implying non-selected applications eat up RAM), or at application selection (implying hidden extra overhead).
    I dream of an equivalent for the C idiom "struct of state variables". Are these issues discussed, in a Sun manual, or elsewhere? Is there a better way?
    Other desperate questions: does a C compiler that output Javacard bytecode make sense/exists? Or a usable Javacard bytecode assembler?
    Francois Grieu

    Interesting post.
    I don't have a solution to your problem, but caching the session variables arrays in local variable arrays is a good start. This should be only done when the applet is in context, e.g. selected or accessed through the shareable interface. This values should be written back to EEPROM at e.g. deselect or some other important point of time. Do you run into problems if a tear happens? I don't think so since the session variables should be transactional, and a defined point will commit a transaction.
    Analyzing the bytecode is a good idea. I know of a view in JCOP Tools (Eclipse plugin) where you can analyze the bytecode and optimize it to your needs.

  • Using Session Variables for User Login - sometimes they don't persist... what am I doing wrong?

    Hi all,
    I'm running a site that requires user login.  I approached the building of this site as almost a complete newb to CF (and dynamic coding in general), and it's been a great learing experience (with lots of help from you guys).
    However, I guess I never learned the correct way to handle a user login.  It seemed to me that I could just test the user-entered credentials against those stored in a database, then set a session variable containg that user's record number.  Then, not only would I have an easy way of knowing who this user was and therefore what info to serve him, but I could test for the existence of a valid login on every page in the protected folder, by adding this code to my application.cfc in that folder:
    <cfset This.Sessionmanagement=true>
    <cfset This.Sessiontimeout="#createtimespan(0,8,0,0)#">
       <cfif NOT isDefined ("session.username") or NOT isDefined ("session.password") or NOT isDefined ("session.storeID")>
         <cflocation url="../index.cfm" addtoken="no">
       </cfif>
    ...and it goes on to run a query and verify that the session.username and session.password match for the store defined by session.storeID.  If not, all session variables are cleared and it bounces you back to the login page.  When the user clicks Logout, all I do is delete all the session variables.
    This seemed to work great for like a year, but lately I've been getting reports that the login doesn't seem to persist for longer than approx. 20 minutes of inactivity.  You can see I specified session variables to remain active for 8 hours (I know that seems like a drastically long login, but it's what's necessary for this application).  I've only gotten this report from a few people, and I myself can't seem to duplicate it... I've tested an inactive login for 45 minutes now and it held.
    SO:  any reason you can think of why session variables would be spontaneously clearing for some people?  Would having your router reset its IP address invalidate the session or something?  Also, the problem seemed to begin appearing after my host upgraded all their servers to CF9... could there be any relation?
    And on a more general note... did I go about this completely the wrong way to begin with?  If so, what's the standard way to manage a login?
    Lots of questions, I know... thanks very much for any answers or suggestions!
    Joe

    Ian,
    Thanks very much - very helpful information.
    Sounds like passing the tokens in every request is probably the way to go for this.  I don't think it's likely that any users will be sharing links, unless they actually intend for the recipient to see their info anyway.
    Is that all I would have to do, is add the tokens to every path?  Would that guarantee that all the session variables would remain valid until timeout or being cleared?
    Again, thanks, you've been really helpful.
    Joe
    On Jun 23, 2010 4:37 PM, Ian Skinner &lt;[email protected]&gt; wrote:
    Unfortunately this is the nature of HTTP web applications.  There is NO state maintained from HTTP request to request.  This is by design in the HTTP protocol specifications.
    ColdFusion provides two methods to circumvent this limitation.  Each method has limitations and caveats.  They both rely on the passing of tokens between the client and the server with every request.  These tokens can be passed as cookies OR URL (GET) variables.  You are using the cookie method, which is the simpler and most common. You may be experiencing the limitation of this method.  If something happens to the cookies the session can be lost.
    You could pass the (CFID &amp; CFTOKEN) OR JESSIONID tokens through the URL query string with every request.  This requires one to add these values to every link, form action, cflocation or other request path in our application.  ColdFusion provides the session.urltoken variable to make this easier to do.  The tokens will be visible to the user.  Also if the links with an individual token is share with other users, via e-mail, chat, social networks, etc and one of these users utilize the link during the life of a session (8 hours apparently in your case).  Then that user will access the session of the original user.
    Cookie session management is by far the most common choice by CF developers.  If these methods do not meet your needs you would need to go beyond the HTTP limitations of web applications.  One might be able to accomplish this with a Flex|Air|Flash applications that can be configured to use a continuous connection to the server.  Thus not suffer the stateless nature of the normal HTTP request-response cycle.
    I do not know if a router resetting would cause cookies to be discarded or otherwise invalidated.  But I would not think it is beyond the relm of possibilities.

  • Session variable and initialization block issues

    We are using OBIEE 10.1.3.3 and utilizes built in security features. (No LDAP or other single sign on). The user or group names are not stored in any external table. I have a need to supplement Group info of the user to the usage tracking we implemented recently as the NQ_LOGIN_GROUP.RESP column contains username instead of group name. So I created a session variable and associated with a new initialization block and also had a junk default value set to the variable. In the initialization block, I wrote the following query and as a result it inserted correct values into the table when the TEST button was clicked from the initialization block form.
    insert into stra_login_data (username, groupname, login_time) values ('VALUEOF(NQ_SESSION.USER)', 'VALUEOF(NQ_SESSION.GROUP)', SYSDATE)
    My intention is to make this execute whenever any user logs on. The nqserver.log reports the following error and it doesn?t insert values into the table.
    [nQSError: 13011] Query for Initialization Block 'SET_USER_LOGIN_BLOCK' has failed.
    [nQSError: 23006] The session variable, NQ_SESSION.USER, has no value definition.
    [nQSError: 13011] Query for Initialization Block 'SET_USER_LOGIN_BLOCK' has failed.
    [nQSError: 23006] The session variable, NQ_SESSION.GROUP, has no value definition.
    When I changed the insert statement as below, this does get populated whenever someone logs in. But I need the values of GROUP associated with the user as defined in the repository.
    insert into stra_login_data (username, groupname, login_time) values ('TEST_USER', TEST_GROUP', SYSDATE)
    Could someone help me out! As I mentioned above, I need the GROUP info into the usage tracking. So, if there is another successful approach, could you please share?
    Thank you
    Amin

    Hi Amin,
    See [this thread|http://forums.oracle.com/forums/thread.jspa?messageID=3376946&#3376946]. You can't use the GROUP session variable in an Init Block unless it has been seeded from an Init Block first. There isn't an easy solution for what you want, but here are some options:
    1) Create a copy of your User => Groups assignments in your RPD in an table so you can use it in your Usage Tracking Subject Area. But this means you will have to replicate the changes in two places so it's not a good solution.
    2) As the GROUP session variable is populated when you login you could theoretically use it a Dashboard and pass it a parameter to write the value to the database. But as I am not sure how can you make fire only once when the user logins it sounds like a bad idea.
    3) Move your User => Groups assignments from your RPD to a DB table. Use OBIEE Write Back or something like Oracle APEX to maintain them.
    I think 3) is the best solution to be honest.

  • Session variable causing ADODB.Field error '800a0bcd'

    i have a page that before the session variable was added,
    would display the
    text i required if the recordset was empty.
    Now i have a session variable on the same page and if the
    recordset is
    empty, instead of showing the text i need displayed, i get
    the following
    error:
    ADODB.Field error '800a0bcd'
    Either BOF or EOF is True, or the current record has been
    deleted. Requested
    operation requires a current record.
    /Help_Desk/verified.asp, line 31
    If i remove the session variable code from the page, it works
    fine.....why
    the conflicts?
    <%Session("last")
    =(rsVerify.Fields.Item("c_last_name").Value)%>
    <%Session("first")
    =(rsVerify.Fields.Item("c_first_name").Value)%>
    <html>
    What im doing is verifying if a user exists in the database.
    If they do
    there name is stored in a session and used later on the
    following pages. If
    they do not exist, they are suppose to receive a message
    indicating to call
    our support center to update there name...
    I dont understand why the addition of the above two lines
    cause this error

    Here is all the code on the page... please let me know if
    there is something
    incorrect.....
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <!--#include file="../Connections/USD.asp" -->
    <%
    Dim rsVerify__varLname
    rsVerify__varLname = "%"
    If (Request.Querystring("last") <> "") Then
    rsVerify__varLname = Request.Querystring("last")
    End If
    %>
    <%
    Dim rsVerify__varFname
    rsVerify__varFname = "%"
    If (Request.Querystring("first") <> "") Then
    rsVerify__varFname = Request.Querystring("first")
    End If
    %>
    <%
    Dim rsVerify
    Dim rsVerify_numRows
    Set rsVerify = Server.CreateObject("ADODB.Recordset")
    rsVerify.ActiveConnection = MM_USD_STRING
    rsVerify.Source = "SELECT c_last_name, c_first_name,
    c_middle_name,
    c_email_addr FROM AHD.ctct WHERE c_last_name = '" +
    Replace(rsVerify__varLname, "'", "''") + "' and c_first_name
    = '" +
    Replace(rsVerify__varFname, "'", "''") + "' and del = '0'"
    rsVerify.CursorType = 0
    rsVerify.CursorLocation = 2
    rsVerify.LockType = 1
    rsVerify.Open()
    rsVerify_numRows = 0
    %>
    <%Session("last")
    =(rsVerify.Fields.Item("c_last_name").Value)%>
    <%Session("first")
    =(rsVerify.Fields.Item("c_first_name").Value)%>
    <html>
    <head>
    <title>Account Verification</title>
    </head>
    <body text="#000000" link="#0000FF" vlink="#0000FF"
    alink="#0000FF"
    leftmargin="0" topmargin="0">
    <!--#include virtual="/inc/header.asp" -->
    <br>
    <br>
    <% If Not rsVerify.EOF Or Not rsVerify.BOF Then %>
    <table width="605" align="center">
    <tr bgcolor="#9999FF">
    <td><strong>USD Name:</strong></td>
    <td><strong><%=(rsVerify.Fields.Item("c_last_name").Value)%>,
    <%=(rsVerify.Fields.Item("c_first_name").Value)%></strong></td>
    </tr>
    <tr>
    <td><strong>First
    Name:</strong></td>
    <td><strong><font
    color="#FF0000"><%=(rsVerify.Fields.Item("c_first_name").Value)%></font></strong></td>
    </tr>
    <tr>
    <td><strong>Last Name:</strong></td>
    <td><strong><font
    color="#FF0000"><%=(rsVerify.Fields.Item("c_last_name").Value)%></font></strong></td>
    </tr>
    <tr>
    <td><strong>Email:</strong></td>
    <td><strong><font
    color="#FF0000"><%=(rsVerify.Fields.Item("c_email_addr").Value)%></font></strong></td>
    </tr>
    <tr>
    <td><strong>Location:</strong></td>
    <td><strong><font
    color="#FF0000"><%=(rsVerify.Fields.Item("c_middle_name").Value)%></font></strong></td>
    </tr>
    <tr>
    <td colspan="2"><div
    align="center"><strong>If all 4 fields above
    contain
    your correct information please select from the links
    below.<br>
    If your are missing any information above please contact the
    help
    desk
    before proceeding.</strong> </div></td>
    </tr>
    <tr>
    <td colspan="2"><hr size="1"> <table
    width="400" align="center">
    <tr>
    <td><div align="center"><strong><a
    href="/Help_Desk/usd_stores1.asp">Open
    Store / DC
    Request</a></strong></div></td>
    <td><div align="center"><strong><a
    href="/Help_Desk/usd_corp1.asp">Open
    Corporate
    Request</a></strong></div></td>
    </tr>
    </table></td>
    </tr>
    </table>
    <% End If ' end Not rsVerify.EOF Or NOT rsVerify.BOF %>
    <br>
    <div align="center">
    <% If rsVerify.EOF And rsVerify.BOF Then %>
    <table width="605">
    <tr>
    <td><div align="center"><font
    color="#FF0000"><strong>If you are
    receiving
    this message, chances are you are not completely setup in
    USD.<br>
    Please contact the help desk to have your information
    verified and
    setup
    if needed.</strong></font>
    </div></td>
    </tr>
    </table>
    <% End If ' end rsVerify.EOF And rsVerify.BOF %>
    </div>
    <div align="center"></div>
    <!--#include virtual="/inc/footer.asp" -->
    </body>
    </html>
    <%
    rsVerify.Close()
    Set rsVerify = Nothing
    %>
    "Daniel" <[email protected]> wrote in message
    news:[email protected]...
    >i have a page that before the session variable was added,
    would display the
    >text i required if the recordset was empty.
    >
    > Now i have a session variable on the same page and if
    the recordset is
    > empty, instead of showing the text i need displayed, i
    get the following
    > error:
    >
    > --------------------------
    > ADODB.Field error '800a0bcd'
    > Either BOF or EOF is True, or the current record has
    been deleted.
    > Requested operation requires a current record.
    >
    > /Help_Desk/verified.asp, line 31
    > -----------------------------
    >
    > If i remove the session variable code from the page, it
    works fine.....why
    > the conflicts?
    >
    > <%Session("last")
    =(rsVerify.Fields.Item("c_last_name").Value)%>
    > <%Session("first")
    =(rsVerify.Fields.Item("c_first_name").Value)%>
    > <html>
    >
    > --------------
    >
    > What im doing is verifying if a user exists in the
    database. If they do
    > there name is stored in a session and used later on the
    following pages.
    > If they do not exist, they are suppose to receive a
    message indicating to
    > call our support center to update there name...
    >
    > I dont understand why the addition of the above two
    lines cause this error
    >
    >

Maybe you are looking for

  • How do I find how large my Hard Drive is? Please help!

    Recently been getting messages saying that my startup disk is full. And I'm thinking about getting a Time Capsule. But the thing is, I can't find out how big my hard drive is. I clicked the apple, then About this mac, and I could only find "Memory",

  • Is it possible to add new characteristic to CCM catalog SRM_EXTRACTED_CTLG?

    Hi Experts, Any idea if I can transfer new extra data from the SRM product master into CCM? (via program BBP_CCM_TRANSFER_CATALOG) So I want to add a new characteristic (e.g. ZVALUEPRICE) to the catalog SRM_EXTRACTED_CTLG and fill it with the valuati

  • Sending Gauges / Equipment for Calibration

    I want to send the Gauges / Equipment for Calibration to Outside party (Vendor). Would you please tell me how to map this process in SAP. The process is: 1. Gauges / Equipments are sent for Calibration to vendor. 2. Vendor Calibrates and those are ve

  • Acknoledgement PI to PI not working

    Hello, an external partner sends a message to our PI 7.0 system. He sends via XI-Adapter (and Internet), and requests an acknoledgement. The normal message is routed via plain HTTP from our PI to another target system (I dont know if this is importan

  • Issues in Deploying the Sample code

    Hi, I downloaded  BusinessObjects Enterprise Java SDK Sample Code from SDK Developer Library.  I unzipped the content to a folder(Sample) in tomcat/webapps.  Now when I launched the application using the following url http://localhost:8080/Sample/sta