Session Persistent Variables

I am working on converting a legacy client/server application to JSP/ADF/Struts in JDeveloper 10g. (and learning Jdev and Java at the same time.) The client/server version maintained a list of variables that persisted during the users's session, and then at application close were posted to a user settings table in the database.
I'm "assuming" that a similar approach is both possible and best in this new environment, but I haven't come across any examples of how to implement it.
Does anyone know of any example projects or documentation that describe how to persist variables throughout a user's session?

What I'd like to maintain are application-specific values, such as the primary key of the selected record, user preferences, etc. (Nothing that Oracle stores in views, unfortunately.) What I'm envisioning is some sort of java class that holds the values, and is maintained by the business tier for the duration of the user's session. Values will change during the session, but once the session is terminated, the values must be flushed to the database and then restored when the user logs in next. What I don't know how to do is how to implement this in the business tier. Is it possible to maintain variables like this and associate them with a specific user? Are there any example apps out there that do that? Alternatively, is there a better way to do this that I haven't thought of?

Similar Messages

  • Different ways to referencing Session State variables

    Hi,
    According to APEX documentation there's 4 different ways to reference session state variables: http://download-west.oracle.com/docs/cd/B32472_01/doc/appdev.300/b32471/concept.htm#BEICHBBG
    In an inline PL/SQL statement, what's the difference when using the different methods? I remember reading something that the bind and static text have a size restrictions. What's the difference between the V() and NV() functions?
    Thank you.
    Martin

    Martin,
    In PL/SQL, the preferable method is to use bind variable notation, e.g., :P1_ITEM. In HTML contexts, you must use &ITEM. notation. In stored procedures, you can use v or nv, the latter function being identical to the former with the additional characteristic that it raises an exception if the retrieved value is non-numeric.
    Scott

  • Session state variables across multiple ApEx applications

    We have a suite of loosely integrate ApEx applications that all share a common authentication scheme. When you first log in we attempt to load a series of session state variables with temporary data to streamline various logging and authentication related activities for the life of the session.
    However, these session variables seem to disappear when you move from one application to another, so they are not truly tied to just the "session" which carries over across all applications, but the application from which the session state is set.
    What is the suggested way, keeping in mind that the data being held may have security related context, to preserve values during a session, but regardless of which ApEx application you are in.
    The method we are using to share the authentication is using a common "Cookie Name" from a common subscribed authentication scheme as suggested elsewhere on this site and seems to work very well outside of this specific issue.
    Thanks in advance,
    Barney

    Apologies for the delay getting back on this.
    My use of the word "disappear" was probably misleading. They were not visible from the second application. When setting "Session State" I was under the impression that it was setting it for the authenticated session, not for the specific application. (I am referring to the: apex_util.set/get_session_state).
    Your solution will work fine, as long as I know which application the user last authenticated against. However, it could be one of over 30 (and growing) different applications which would require me writing a program to go through every "p_flow" to try and find a valid value every time I need to reference the field.
    It would be really beneficial if you could store true Session variables which stay alive for the life of the authenticated session and is available to anything authenticated against that session id. This would streamline alot of cross-application program development.
    The "get/set_session_state" is a misleading as it is not a Session value, but an Application value. The Session exists across multiple applications, while this procedure does not.
    Thanks,
    Barney

  • Session-scope variable for JSP page used in a frame

    Hi,
    I don't know if there's a way to do this at the same time:
    (1)- assign session scope to a variable (in order to be able to retrieve recurrently the previous value each time the JSP is called);
    (2)- set its visibility in a way that it could be accessed only by the page that defines it. The JSP is used in a frameset along with an other JSP that can potentially define identical session-scoped variable (You understand why I want to keep them separate)
    session.setAttribute():
    seems not to be the thing I need
    pageContext.setAttribute():
    with SESSION_SCOPE, it behaves the same way as session.setAttribute(). with PAGE_SCOPE, condition (1) can't be satisfied.
    Does anybody have an idea ?
    Thanx in advance.

    I can see that you will not want to maintain two different files for every possible page on the site!
    It may be possible to do something like <frameset rows="*" cols="50%,*">
      <frame name="content1" src="file.jsp?frame=one" >
      <frame name="content2" src="file.jsp?frame=two" >
    </frameset>and then in the jsp<%
    String frame=request.getParameter("frame");
    session.setAttribute(frame+"AttributeName",attributeValue);
    %>This will set up two session attributes - "oneAttributeName" and "twoAttributeName". Depending on how many variables you have, this may prove just as difficult to maintain.
    You may end up having to simply pass url parameters between pages to maintain state within the individual frames, which is far from elegant also.
    I am interested in how you end up solving this one.

  • Session member variable usage

    I want to keep client-specific information for each incoming connection, but i heard it cannot be done with session variable. i read in a book that session variables in a servlet (or scriptlet section of a jsp page) are shared among all incoming threads (therefore all clients) accessing the servlet.
    I guess a simple example of what i want to acheive is a shopping cart, but keeping the shopping cart order in a session-like variable specific to the original client machine/user who placed the order.
    I thought of doing something like:
    request.getSession().setAttribute("ShoppingCart", cart);
    inside my doGet() method in a servlet. And a book author says it won't work. He says ff I use a member to keep information about user1, sometimes the session variable may be overwritten by user2 if they are accessing the servlet at the same time.
    1) Can someone confirm whether session variables are shared among all incoming requests to the same servlet?
    2) If so, how can i easily keep track of incoming user/client mahcine-specific information, without using cookies or other client-side storage methods.
    3) If client side storage is necessary (to keep user info), what are the common techniques and the classes used?
    I am fairly new to j2ee so i would appriciate it if you can explain in layman's terms.

    Hi,
    Session scope is made to save the user specific information only. All class(servlet) level members(state) can be shared by all incoming thread. So its a bad practice, if we used class level session variable which stores the client specific info.
    I dont think session will overwritten if you used session var locally(inside any method).
    When any user logs in you should create a new session for that user.
    Means if you have LoginServlet.java file which have log in functionality, Here only you need to create new session.
    HttpSession session = request.getSession();
    Other than this file every where you need to use
    request.getSeission(false);
    In your case it would be
    request.getSession(false).setAttribute("ShoppingCart", cart);
    Hope This will help you.

  • Coldfusion session/client variables?

    We have multiple users using VPN to get to our intranet.  When the second user gets on they get the first person's session/client variables?
    I have tried looking for the session/client variables and where they are stored but I can't seem to find them.  I have tried searching out the cookies.
    I would appreciate any help.

    There are not too many people on this forum that have dabbled with ColdFusion. I used to, but that was more than one decade ago.
    Your best bet on getting assistance with your problem, is to go to the ColdFusion forum.

  • Session scope variables and weird behaviour of AdfContext()

    Hello,
    what is the best method and correct API to create a session scope variable?
    I am currently using ADFContext().getCurrent().getSessionScope().get()/put(), but it looks like it has some problems: for some unkown reasons I loose the variable, that is get() returns null when called from a method of a (overridden)ViewRowImpl. Why does this happen?
    Thanks you in advance

    There are a couple of ways you can set values on a sessions scope but I would have to question if you really need a scope as high as session to accomplish what you want to do. At any rate, you should be able to store the value using the method you described but you could also try setting it using EL by using the setExpressionValue and resolveExpression methods in JSFUtils.java (you can find this in the latest fusion demo application). JSFUtils also has a getFromSession and storeOnSession that you could try.
    With all that said I don't think it is good practice to access scope variables from your model layer. You should write your method in the ViewRowImpl class to accept the value as a method parameter and then pass the value in through the binding layer or when invoking the method from your bean class.

  • Jsf session scope variables

    Hi All,
    How to set a variable which should be available throughout the session, I dont want to use session scoped managed beans for this.
    Using the following method is not working
    FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("variableName","value");is there any other way to set session scoped variables ?

    Got it working
    FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("variableName","value");This will make the variable session scoped
    Regards,
    Sai Krishna

  • Servlet session persistance within iAS 6.0 SP3

    Hi,
    Is it possible to provide failover for servlets, keeping session
    persistance, between 2 iAS in a cluster?
    What I trying to do is to use the iAS to provide me redundancy for an
    application that is 100% based on Servlets and JSP (no EJBs). Is this
    possible?
    Marcelo Manta
    Barcelona Technology Center
    [email protected]
    phone: +34 67 699-5921 (ESN 746)

    Hi Manta,
    Yes, it is very well possible with iAS.
    If your application is already deployed than to make that distributed so
    that both the iAS(Primary and Backup) will store the sesson information,
    you need to change few entries of your application in the registry of
    both iAS, these are -
    - run kregedit
    - go to iplanet/Application Server/6.0/J2EE-Module/<App_name> node
    than
    - insert your domain name value in session-domain key.
    - modify the session-impl key value to distributed.
    - insert the session-path key value as / (slash)
    - ensure that the key session-dsync-type is dsync-distributed
    at the end, your key values should look like this -
    - session-domain=your.domain.name
    - session-dsync-type=dsync-distributed
    - session-impl=distributed
    - session-path=/
    Note: you should make these changes in the registry of all the iAS
    servers that are participating in your cluster, or you can redeloy the
    Application on all the servers, with appripriate deployment descriptor.
    Than restart the two web servers(iws) and the two iAS servers in the
    cluster.
    Note: start the highest priority server(Primary) first.
    The clustering and the distributed session failover can be better seen
    through the clustering-examples/samples provided with iAS, like
    clustering-servlet and clustering-jsp.
    Please see the page:
    http://<hostname.domainname>:<http-port>/ias-samples
    for all the sample applications that comes with iAS and
    http://<hostname.domainname>:<http-port>/ias-samples/cluster/docs/index.html
    for cluster related sample application.
    Please feel free to mail me if you have any further queries.
    Sanjeev,
    Developer Support Group iAS
    "Manta, Marcelo [BLMES:0B70:EXCH]" wrote:
    Hi,
    Is it possible to provide failover for servlets, keeping session
    persistance, between 2 iAS in a cluster?
    What I trying to do is to use the iAS to provide me redundancy for an
    application that is 100% based on Servlets and JSP (no EJBs). Is this
    possible?
    Marcelo Manta
    Barcelona Technology Center
    [email protected]
    phone: +34 67 699-5921 (ESN 746)

  • Store Session scoped variable in RequestScoped FormHandler?

    Hi All,
    I need to store a value into session scoped variable in formHandler. Is it possible? For Example, i need to no.of times handleApplyShippingGroups is being called by a User (Session scoped) and write a condition based on that value whose effect is to that User only? But, ShippingGroupFormHandler's scope is "Request"? How to get through this?
    Thanks,
    VishnuVardhan

    Hi,
    You can use the below logic.
    In ShippingGroupFormHandler.properties
    $class = your.custom.Shippinggroup.fomhandler
    profile=/path/to/your/profile/component
    In YourShippingGroupFormHandler.java
    Inside handleApplyShippingGroups(),
    //increment the value
    getProfile.setApplySgCallCount(getApplySgCallCount()++);
    Before that, add the property - applySgCallCount -  to your profile with getter and setters.
    Hope this helps.
    Please keep posting the issues / updates.
    Thanks,
    Gopinath Ramasamy

  • What is persistent variable?

    Hi!
    what is the correct definition for persistent variable in java?
    Thanx
    -Sasi

    what is the correct definition for persistent variable
    in java?In what context did you see this?
    The term "persistent" is used to refer to data which maintains state between runs of the applications. The data is stored in some fashion (database or file.)
    As an example the following two terms are equivalent (although the first is more general.)
    The customer will be persisted.
    The customer will be stored in the database.
    Normally a single variable is not stored. Although that might be the case for user preferences in a GUI for example.

  • Can we access the session scoped variable by simply using its name

    The Java EE 6 Tutorial contains a "Duke's Bookstore Case Study Example”. I could not understand following statements of this case study:
    *bookdetails.xhtml*
    {code}
    <h:outputText value="#{selected.title}"/>
    {code}
    *BookstoreBean.java*
    {code}
    public String details() {
    context()
    .getExternalContext()
    .getSessionMap()
    .put(
    "selected",
    getFeatured());
    return ("bookdetails");
    {code}
    I want to know can we access the session scoped variable in bookdetails.xhtml by simply using its name as done above?

    It is basic Expression Language (EL) functionality, it isn't even specific to JSF. And it isn't specific to the session scope either, you can put beans in any scope (page, request, session, application, flash, conversation, whatever custom scope you create) and reference it using EL by only its name. The thing that you have to take care of is that the bean lives in SOME scope, which can be achieved using JSF specific annotations or configuration files, through CDI or by manually putting the bean in a specific scope through Java code. It's flexible, which is the nature of the Java platform.

  • Persistent variable in package

    Hey,
    I am not sure where exactly to ask about this, so if I posted in the wrong forum forgive me.
    My problem is this: I am writing an application which interacts with a remote server using the functions in the utl_tcp package. This works with no problems in testing, but after I put a web interface on it I discovered that what I thought were global variables (defined in the package spec) are being reset every time a new call is made to the server. The interface works by repeatedly calling a certian function in my package which checks the tcp stream (what I want to be my 'global' variable) for any new information coming downstream. When it does this though the stream is gone, the variable has been reset with every request.
    I tested this with a more simple variable too to make sure it just wasnt some quirk of the tcp connection type. What I want to happen in the code is everytime the procedure 'increment' is hit the variable would increase. This is that test code:
    PACKAGE test IS
       testNum number := 0;
       PROCEDURE increment;
    END test;
    PACKAGE BODY test IS
       PROCEDURE increment IS
       BEGIN
           testNum := testNum + 1;
           htp.prn('Current value: ' || testNum);
       END;
    END test;
    After hitting that procedure a few times the output was 1 every time, so it would seem what I had believed to be 'global' variables are actually local to the request, reset every time, and that is not going to work for me. I need some persistance.
    Someone mentioned something to me about storing variables in a session object, but I don't know anything about that (yet)...
    Any help would be appreciated.

    Hey,
    I am not sure where exactly to ask about this, so if I posted in the wrong forum forgive me.
    My problem is this: I am writing an application which interacts with a remote server using the functions in the utl_tcp package. This works with no problems in testing, but after I put a web interface on it I discovered that what I thought were global variables (defined in the package spec) are being reset every time a new call is made to the server. The interface works by repeatedly calling a certian function in my package which checks the tcp stream (what I want to be my 'global' variable) for any new information coming downstream. When it does this though the stream is gone, the variable has been reset with every request.
    I tested this with a more simple variable too to make sure it just wasnt some quirk of the tcp connection type. What I want to happen in the code is everytime the procedure 'increment' is hit the variable would increase. This is that test code:
    PACKAGE test IS
       testNum number := 0;
       PROCEDURE increment;
    END test;
    PACKAGE BODY test IS
       PROCEDURE increment IS
       BEGIN
           testNum := testNum + 1;
           htp.prn('Current value: ' || testNum);
       END;
    END test;
    After hitting that procedure a few times the output was 1 every time, so it would seem what I had believed to be 'global' variables are actually local to the request, reset every time, and that is not going to work for me. I need some persistance.
    Someone mentioned something to me about storing variables in a session object, but I don't know anything about that (yet)...
    Any help would be appreciated.

  • Cisco Loadblancer session persistent settings

    Cisco CSS11503, Version: sg0820501 (08.20.5.01), box-to-box redundancy
    Issue - We have the problem that after a short while the agent didn’t have a persistent session and gets the message that there is no connection to the server and that he has to close the application. This only happens when they log in to our load balancer http://egainagent/default. If we use a direct connection to the app servers we can work on normally.
    Could you please help me with setting which needs to be enabled on F5 to resolve this issue. Any document or screenshots.
    Thanks in advance.
    Regards,
    Gaurav Thakur.

    What I'd like to maintain are application-specific values, such as the primary key of the selected record, user preferences, etc. (Nothing that Oracle stores in views, unfortunately.) What I'm envisioning is some sort of java class that holds the values, and is maintained by the business tier for the duration of the user's session. Values will change during the session, but once the session is terminated, the values must be flushed to the database and then restored when the user logs in next. What I don't know how to do is how to implement this in the business tier. Is it possible to maintain variables like this and associate them with a specific user? Are there any example apps out there that do that? Alternatively, is there a better way to do this that I haven't thought of?

  • Passing Session State Variables to SQL query

    Hi,
    I am using 3 pages in my application build by APEX 3.1.2. Login Page, Report Page and Form Page.
    I am using LDAP authentication for Login Page and I want the user session information to be feeded to the filter query
    being used to display data on Report Page. Is there any way to do that. I know
    there is one variable %LDAP_USER% which is using the userid given on login
    page. But I dont know how to use APEX session variables to filter query. Need
    assistance on that stuff.
    Thanks,
    Gaurav

    Hi Gaurav,
    Session "variables" (global items, application items and page items) can be accessed using v('ITEM_NAME') (for strings) or nv('ITEM_NAME') (for numbers) within sql queries/procedures/triggers etc.
    If you look at the Substitution Strings section here: http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10499/index.htm#S you'll find more information about this and a list of items that you can use that are set by Apex itself.
    Andy

Maybe you are looking for

  • TV Locks Up - won't return to movies

    I've seen that my TV locks up about every other week and I've been meaning to call in but just haven't been able to during "normal" hours. The issue used to go away when I'd reset the TV using the remote but now, not even that is helping. This even

  • TEXT_IO IN ORACLE FINANCIAL

    Hi I'm working in a customizing for the Oracle Inventory Module. I'm using TEXT_IO for managing some file. My problem is that when I use TEXT_IO.fclose for closing the file this one does not close. The pl/sql code into a button should work that way:

  • Query regarding certification in sql and plsql

    Dear all, I am interested to do a certification in SQL and PLSQL. Could anyone suggest the best certification course for a beginner.

  • Ess/mss best practice

    When implementing employee self service and manager self service what are the best practices when creating ids.  Do most use active directory. Or employee Ids and or generated numbers.  I would like to know what the best methods some may recommend. T

  • Accidently Expired Accounts

    Hi folks, I just did my dumb thing for the week. In my DEV environment, I accidently expired some user accounts. Is there a syntax to unexpire accounts?