Synchronizing session-scope objects?

          Hi,
          I have this problem, using Weblogic 5.1 SP8:
          In a JSP-file I use a java-object with the useBean-directive and
          session-scope.
          The problem occur when a user (for some strange reason) decides
          to double-click in his browser on a link pointing to this
          JSP-page.
          This makes the weblogic server start two separate request-threads to the same page
          in the same session. This will sometimes screw up tha data that the java-object holds
          since both threads at the same time uses the same object.
          The only solution that I have found is to put synchronized blocks in the JSP-file
          either synchronizing the java-object or the session-object.
          Does anyone have any similar problems or perhaps any opinions?
          regards/
          H Waller
          

          The problem we discussed (and fixed)was specifically in
          WLCS 3.2.
          If you are not using WLCS, you will not experience THAT problem.
          If you are using member servlet, member JSP variables or static
          variables, you will see a similar problem - don't.
          If it is data in the httpSession - you have to rethink your
          design.
          Mike
          "Ashutosh Khandelwal" <[email protected]> wrote:
          >
          >Hello Ture and Mike,
          >
          >I have been experiencing problems when a user decides to double-click
          >in the browser
          >pointing to a servlet. This makes the weblogic server start two seperate
          >request-thread
          >to the same page in the same session. This always screws up the data.
          >I am using
          >WLS 5.1 with SP8.
          >
          >According to your previous emails, this was only a problem with WLCS3.2,
          >which
          >uses PipelineSession. You have also indicated that this should not be
          >happening
          >with WLS 5.1 or 6.0 with SP8 or above.
          >
          >Well, I continue to have this problem with WLS5.1. Do you have any suggestions/opinion,
          >etc.
          >
          >regards,
          >
          >Ashu
          >
          >
          >
          >"Mike Reiche" <[email protected]> wrote:
          >>
          >>Thanks for the fast turn-around.
          >>
          >>- Mike
          >>
          >>Ture Hoefner <[email protected]> wrote:
          >>>Hello Mike,
          >>> As you know, a WLCS 3.2 (Commerce Server)
          >>>patch now exists for this problem. I thought
          >>>that I should post the details here to clear
          >>>up any confusion in the WebLogic user
          >>>community.
          >>> The problem that Mike experienced was that
          >>>the WLCS PipelineSession was keeping all
          >>>request-scoped attributes in a single bucket,
          >>>so concurrent requests from a single session
          >>>were experiencing naming collisions. Also,
          >>>one pipeline would empty the bucket when
          >>>finished, but other concurrent piplines may
          >>>have been using the bucket. This was not a
          >>>problem with WLS. It was a limitation of the
          >>>design of WLCS 3.2 PipelineSession, which is
          >>>not used in WLS 5.1 or 6.0.
          >>> Our engineering team has quickly responded:
          >>> they have designed and implemented a
          >>>PipelineSessionExtended that uses multiple buckets.
          >>> Each bucket is associated with a
          >>>request using a unique requestId.
          >>> A patch and details of the design fix and
          >>>use of the patch are available from support.
          >>>Please reference CR043462 when requesting the
          >>>patch.
          >>>
          >>>Mike Reiche wrote:
          >>>
          >>>> I don't mind that the HttpSession is shared,
          >>>my problem
          >>>> is that the PipelineSession is shared - because
          >>>that
          >>>> breaks <pipeline:getProperty > tags. When
          >>>I save a Pipeline
          >>>> propert as REQUEST_SCOPE, that's exactly what
          >>>I expect. But
          >>>> apparently, it's scope is beyond a request.
          >>>>
          >>>> What about a PageContext? That's not shared
          >>>between requests,
          >>>> is it? Maybe that's where REQUEST_SCOPE variables
          >>>should be
          >>>> stored.
          >>>>
          >>>> Mike
          >>>>
          >>>> Robert Patrick <[email protected]>
          >>>wrote:
          >>>> >Hmm...
          >>>> >
          >>>> >I always thought that it was browser specific
          >>>whether
          >>>> >the multiple browser windows
          >>>> >shared or did not share the same session
          >>>(and the Netscape
          >>>> >and IE do exactly the
          >>>> >opposite thing here). Regardless of the
          >>>multiple window
          >>>> >scenario, this can and will
          >>>> >happen if you have multiple frames in the
          >>>same window
          >>>> >making requests concurrently (or
          >>>> >possibly if you double-click on a link causing
          >>>the browser
          >>>> >to generate two requests to
          >>>> >WebLogic).
          >>>> >
          >>>> >Anyway, the crux of the matter is that your
          >>>servlets/JSPs
          >>>> >must be prepared to deal with
          >>>> >multiple requests from the same user accessing
          >>>the same
          >>>> >session. The servlet/JSP spec
          >>>> >doesn't, to my knowledge, address this issue.
          >>> You will
          >>>> >probably need to add
          >>>> >synchronization code somewhere, I would just
          >>>make sure
          >>>> >that you are synchronizing on an
          >>>> >object that is only used by one user (e.g.,
          >>>session) and
          >>>> >keep the synchronization
          >>>> >blocks as short as possible...
          >>>> >
          >>>> >Hope this helps,
          >>>> >Robert
          >>>> >
          >>>> >Michael Reiche wrote:
          >>>> >
          >>>> >> BEA says that's just your imagination....
          >>>> >>
          >>>> >> FR: nelson
          >>>> >>
          >>>> >> CASE_ID_NUM: 222714
          >>>> >> MESSAGE:
          >>>> >> Hi Michael,
          >>>> >>
          >>>> >> The Commerce Server is nothing more then
          >>>an application
          >>>> >riding
          >>>> >> on top of WebLogic Server.
          >>>> >> The HTTPSession is still being managed
          >>>by the WebLogic
          >>>> >Server,
          >>>> >> and not the Commerce Server.
          >>>> >> As I mentioned on my previous email, prior
          >>>to and including
          >>>> >SP6
          >>>> >> for WLS 5.1, the spawning of a child browser
          >>>window,
          >>>> >does create
          >>>> >> a shared HTTPSession, thus creating a shared
          >>>PipelineSession.
          >>>> >>
          >>>> >> If you have indeed upgraded to SP8 for
          >>>WLS 5.1, then
          >>>> >this should
          >>>> >> not be happening.
          >>>> >> Can you tell us exactly how you are spawning
          >>>the new
          >>>> >browser window,
          >>>> >> such that both requests are being sent
          >>>almost concurrently.
          >>>> >> Also, can you send us a copy of your "weblogic.log"
          >>>> >file from the
          >>>> >> Commerce Server as an attachment. If it
          >>>is large, please
          >>>> >zip it.
          >>>> >>
          >>>> >> Regards,
          >>>> >> Nelson Paiva
          >>>> >> WLCS DRE
          >>>> >>
          >>>> >> **********
          >>>> >> If you are replying to this email, please
          >>>DO NOT modify
          >>>> >the subject
          >>>> >> of
          >>>> >> this email in order to ensure that your
          >>>reply is processed
          >>>> >automatically.
          >>>> >>
          >>>> >> You can now "AskBEA" Customer Support questions
          >>>on the
          >>>> >web and
          >>>> >> get
          >>>> >> immediate responses. "AskBEA" is available
          >>>on http://www.bea.com/support/index.html
          >>>> >> **********
          >>>> >>
          >>>> >> "H Waller" <[email protected]>
          >>>wrote:
          >>>> >> >
          >>>> >> >Hi,
          >>>> >> >
          >>>> >> >I have this problem, using Weblogic 5.1
          >>>SP8:
          >>>> >> >
          >>>> >> >In a JSP-file I use a java-object with
          >>>the useBean-directive
          >>>> >> >and
          >>>> >> >session-scope.
          >>>> >> >The problem occur when a user (for some
          >>>strange reason)
          >>>> >> >decides
          >>>> >> >to double-click in his browser on a link
          >>>pointing to
          >>>> >this
          >>>> >> >
          >>>> >> >JSP-page.
          >>>> >> >This makes the weblogic server start two
          >>>separate request-threads
          >>>> >> >to the same page
          >>>> >> >in the same session. This will sometimes
          >>>screw up tha
          >>>> >> >data that the java-object holds
          >>>> >> >since both threads at the same time uses
          >>>the same object.
          >>>> >> >
          >>>> >> >The only solution that I have found is
          >>>to put synchronized
          >>>> >> >blocks in the JSP-file
          >>>> >> >either synchronizing the java-object or
          >>>the session-object.
          >>>> >> >
          >>>> >> >Does anyone have any similar problems
          >>>or perhaps any
          >>>> >opinions?
          >>>> >> >
          >>>> >> >regards/
          >>>> >> >H Waller
          >>>> >
          >>>
          >>>--
          >>>Ture Hoefner
          >>>BEA Systems, Inc.
          >>>2590 Pearl St.
          >>>Suite 110
          >>>Boulder, CO 80302
          >>>www.bea.com
          >>>
          >>>
          >>
          >
          

Similar Messages

  • Is Weblogic Cluster  supports Application scope Objects?

              Our Application is mainly depends on Application scope objects. On one m/c, it
              is perfect.
              Now, we want to support the failover , load balancing ... (High Availability).
              I know, weblogic cluster supports HttpSessions, EjbObjects ... etc. What about
              Application scope objects.
              we are planning for weblogic server which supports the our requirements.
              If not, what is the solution to make it work by using Weblogic server.
              for eg: I can give what type of application we are developing --- similar to
              textchat.
              our application is real time application.
              

    Even a singleton is not good enough as singletons are good only in the VM they were
              created it. One way is to have a distributed object such as a stateful session bean of
              which only one instance exists. U can create it at startup and store its handle in
              some persistent storage as well as a singleton. This ensures that even if the
              singleton doesnt contain it the refgerence to it can be obtained.
              There will be some problems with this setup as people should not allow it to create
              instances of it . Any such endeavor will lead to a CacheFullException.
              But essentially that seems possible.
              Even the 2.3 Servlet specification mandates that ServletContext and Application level
              object is only valid inside the JVM which created it. HttpSessions are replicated
              SessionContexts are not and are not likely to be in any J2EE application server
              Sameer
              Devi wrote:
              > One more comment from my side,
              > U mentioned "EXCEPT FOR JNDI" , if this is possible, how can we acheive?
              > Can U give brief description ? Take textchat example itself? since, our application
              > is almost have same mechanism. If it is < 1 sec delay means acceptable for this
              > release.
              >
              > Thanks,
              > Devi
              >
              > "Cameron Purdy" <[email protected]> wrote:
              > >Weblogic doesn't support replicated / synchronized app scope objects
              > >across
              > >a cluster except for JNDI, which is probably not a good solution for
              > >what
              > >you are describing.
              > >
              > >If you need a real-time shared fault-tolerant fail-overable high-performance
              > >load-balanced high-scale data store, then let me know when you find one
              > >;-)
              > >.... seriously, there are not a whole lot of good general purpose solutions
              > >in this space. There are some things to look at but they are all expensive:
              > >
              > >Persistent PowerTier on top of Oracle - a caching entity EJB server
              > >Jasmine (or whatever it is called this week) - an object oriented
              > >distributed data store
              > >....
              > >
              > >Peace,
              > >
              > >--
              > >Cameron Purdy
              > >Tangosol Inc.
              > ><< Tangosol Server: How Weblogic applications are customized >>
              > ><< Download now from http://www.tangosol.com/download.jsp >>
              > >
              > >
              > >"Devi" <[email protected]> wrote in message
              > >news:[email protected]...
              > >>
              > >> Our Application is mainly depends on Application scope objects. On
              > >one
              > >m/c, it
              > >> is perfect.
              > >> Now, we want to support the failover , load balancing ... (High
              > >Availability).
              > >>
              > >> I know, weblogic cluster supports HttpSessions, EjbObjects ... etc.
              > > What
              > >about
              > >> Application scope objects.
              > >> we are planning for weblogic server which supports the our requirements.
              > >>
              > >> If not, what is the solution to make it work by using Weblogic server.
              > >> for eg: I can give what type of application we are developing ---
              > >similar to
              > >> textchat.
              > >> our application is real time application.
              > >>
              > >
              > >
              

  • Put an Object in the session scope

    I write a logon() action . Inside, i retrieve informations about user logon from a UserForm Object define in the faces-config.xml file with a request scope. So I want to set a business Object called User with the UserForm's values. Then i need to put the User Object in the session scope but i don't know how to do ?
    Can someone help me ?
    Thanks.

    I write a logon() action . Inside, i retrieve
    informations about user logon from a UserForm Object
    define in the faces-config.xml file with a request
    scope. So I want to set a business Object called User
    with the UserForm's values. Then i need to put the
    User Object in the session scope but i don't know how
    to do ?
    Can someone help me ?
    Thanks.The session attributes are available via the "sessionMap" property of the ExternalContext for this request. So, from within your Action, you could do something like this:
    User user = ... set up your user object ...;
    // Get FacesContext for this request
    FacesContext context =
      FacesContext.getCurrentInstance();
    // Store user object in the session map
    context.getExternalContext().getSessionMap().put("user", user);Craig McClanahan

  • Problem with beans in session scope

    Hello,
    I developped a website using JSP/Tomcat and I can't figure out how to fix this problem.
    I am using beans in session scope to know when a user is actualy logged in or not and to make some basic informations about him avaible to the pages. I then add those beans to an application scope bean that manages the users, letting me know how many are logged in, etc... I store the user beans in a Vector list.
    The problem is that the session beans never seem to be destroyed. I made a logout page which use <jsp:remove/> but all it does is to remove the bean from the scope and not actualy destroying it. I have to notify the application bean that the session is terminated so I manualy remove it from its vector list.
    But when a user just leave the site without using the logout option, it becomes a problem. Is there a way to actualy tell when a session bean is being destroyed ? I tried to check with my application bean if there are null beans in the list but it never happens, the user bean always stays in memory.
    Is there actualy a way for me to notify the application bean when the user quits the website without using the logout link ? Or is the whole design flawed ?
    Thanks in advance.
    Nicolas Jaccard

    I understand I could create a listener even with my current setup Correct, you configure listeners in web.xml and they are applicable to a whole web application irrespective of whether you use jsp or servlets or both. SessionListeners would fire when a session was created or when a session is about to be dropped.
    but I do not know how I could get a reference of the application bean in >question. Any hint ?From your earlier post, I understand that you add a UserBean to a session and then the UserBean to a vector stoed in application scope.
    Something like below,
    UserBean user = new UserBean();
    //set  bean in session scope.
    session.setAttribute("user", user);
    //add bean to a Vector stored in application scope.
    Vector v = (Vector)(getServletContext().getAttribute("userList"));
    v.add(user);If you have done it in the above fashion, you realize, dont you, that its the same object that's added to both the session and to the vector stored in application scope.
    So in your sessionDestroyed() method of your HttpSessionListener implementation,
    void sessionDestroyed(HttpSessionEvent event){
         //get a handle to the session
         HttpSession session = event.getSession();
          //get a handle to the user object
          UserBean user = (UserBean)session.getAttribute("user");
           //get a handle to the application object
          ServletContext ctx = session.getServletContext();
           //get a handle to the Vector storing the user objs in application scope
            Vector v = (Vector)ctx.getAttribute("userList");
           //now remove the object from the Vector passing in the reference to the object retrieved from the Session.
            v.removeElement(user);
    }That's it.
    Another approach would be to remove the User based on a unique identifier. Let's assume each User has a unique id (If your User has no such feature, you could still add one and set the user id to the session id that the user is associated with)
    void sessionDestroyed(HttpSessionEvent event){
         //get a handle to the session
         HttpSession session = event.getSession();
          //get a handle to the user object
          UserBean user = (UserBean)session.getAttribute("user");
           //get the unique id of the user object
           String id = user.getId();
           //get a handle to the application object
          ServletContext ctx = session.getServletContext();
           //get a handle to the Vector storing the user objs in application scope
            Vector v = (Vector)ctx.getAttribute("userList");
           //now iterate all user objects in the Vector
           for(Iterator itr = v.iterator(); itr.hasNext()) {
                   User user = (User)itr.next();               
                    if(user.getId().equals(id)) {
                           //if user's id is same as id of user retrieved from session
                           //remove the object
                           itr.remove();
    }Hope that helps,
    ram.

  • Session scope and request scope

    Hi,
    I've a manage bean in session scope and within this bean I've a reference of another
    object (class person) . My question is, do i have to register this class in my faces-config-xml and if yes which scope should it have? session or request?
    Or it isn't necessary to register it?
    thanks
    class MymanageBean{
    private Person myPerson;
    }

    helllo,
    can someone tell me what the line in the preceding coed means?
    <meta http-equiv="refresh" content="<%= session.getMaxInactiveInterval() %>;url=login.jsp">
    -- session_expiry_test.jsp --
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
            <meta http-equiv="refresh" content="<%= session.getMaxInactiveInterval() %>;url=dummy_login.jsp">
        </head>
        <body>
        <h1>Welcome, dude with a session!</h1>
        Your session will expire in <%= session.getMaxInactiveInterval() %> seconds
        at which time your browser will be redirected to the login page and any
        and all unsaved changes will be lost.
        <br>
        Thank you for your cooperation!
        </body>
    </html>

  • Cant able to get the output while using session scope

    Hi
    I am using jdeveloper 11.1.1.5
    As i posted in the previous post i had made some changes still i am not getting proper output
    These are steps that i had followed for developing login page
    1.I had created a TaskFlow in adfc-config.xml such that if the login is success it navigates to the other page pls verfiy the link
    http://www.4shared.com/photo/5PNrf1hd/E028_2.html
    2.I had also changed the scope to session in adfc-config.xml
    http://www.4shared.com/photo/HtVVOw_B/E029.html
    3.This was my Welcome.jspx code
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document id="d1" binding="#{sessionScope.backing_welcome.d1}">
          <af:form id="f1" binding="#{sessionScope.backing_welcome.f1}">
            <af:inputText label="UserName" binding="#{backing_welcome.it1}"
                          id="it1" value="#{sessionScope.backing_welcome.auser}"/>
            <af:inputText label="Password" binding="#{backing_welcome.it2}"
                          id="it2"
                          value="#{sessionScope.backing_welcome.apassword}"/>
            <af:commandButton text="Login"
                              binding="#{backing_welcome.cb1}" id="cb1"
                              action="#{backing_welcome.cb9_action}"/>
          </af:form>
        </af:document>
      </f:view>
      <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_welcome-->
    </jsp:root>3.This was my welcome.java backing bean for welcome.jspx page
        public String getAuser() {
            return auser;
        public void setApassword(String apassword) {
            this.apassword = apassword;
        public String getApassword() {
            return apassword;
        public String cb9_action() {
            String returnStr="error";
            System.out.println("Inside loginBtn_action");
            BindingContainer bindings = getBindings();
            OperationBinding operationBinding = bindings.getOperationBinding("checkLoginCredentials1");
            operationBinding.getParamsMap().put("p_user", auser);
            operationBinding.getParamsMap().put("p_pwd", apassword);
        operationBinding.execute();
        Object result = operationBinding.execute();
        if (!operationBinding.getErrors().isEmpty()) {
            returnStr= "success";
        System.out.println("returnStr= " + returnStr);
               return returnStr;
        }While i run my program no output is displayed!! No logs also been recorded!!
    Could any body pls help me!!

    thank you jhon!
    If i am not using any binding i m getting error as
    javax.el.PropertyNotFoundException: Target Unreachable, 'backing_welcome' returned nullI had used this jspx code
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document id="d1" >
          <af:form id="f1" >
            <af:inputText label="UserName"
                          id="it1" value="#{sessionScope.backing_welcome.auser}"/>
            <af:inputText label="Password"
                          id="it2"
                          value="#{sessionScope.backing_welcome.apassword}"/>
            <af:commandButton text="Login"
                               id="cb1"
                              action="#{sessionScope.backing_welcome.cb9_action}"/>
          </af:form>
        </af:document>
      </f:view>
      <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_welcome-->
    </jsp:root>Give me some guide how to use session scope!! Since i read all the documents i m not getting any proper output

  • TopLink Essentials: Using spring session scope on the EntityManagerFactory

    Hi,
    In one of our projects we are trying to utilize the 2nd level cache of TopLink Essentials. The server code is using the Spring (2.0.7) and is deployed to a web container. We are using a Java client and serializes every object between the client and the server.
    When a client is started a lot of "static/common" data is read from the server. The first client started will therefor pay some extra performance cost, but additional clients should hopefully be able to perform better due to the cache. Most of the static data is accessed not using JPQL and should therefor not bypass the cache.
    If we configure the EntityManagerFactory using default Spring scoping (singleton) it seems like we are not able to utilize the cache. We can see from the log files that each time a client is started a lot of SQL is executed towards the database (Oracle).
      <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="jpaVendorAdapter">
          <bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
            <property name="showSql" value="false" />
            <property name="generateDdl" value="$repository{toplink.generateDdl}" />
            <property name="database" value="$repository{toplink.database}" />
          </bean>
        </property>
        <property name="jpaProperties">
          <props>
            <prop key="toplink.weaving">static</prop>
            <prop key="toplink.logging.level">FINEST</prop>
          </props>
        </property>
      </bean>When we changes the scoping to spring session the behavior is very different. Then we can see that the first client generates a lot of SQL towards the database and pays a startup cost, while subsequently clients seems to be able to utilize the cache.
      <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" scope="session">
        <aop:scoped-proxy />
        <property name="dataSource" ref="dataSource" />
        <property name="jpaVendorAdapter">
          <bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
            <property name="showSql" value="false" />
            <property name="generateDdl" value="$repository{toplink.generateDdl}" />
            <property name="database" value="$repository{toplink.database}" />
          </bean>
        </property>
        <property name="jpaProperties">
          <props>
            <prop key="toplink.weaving">static</prop>
            <prop key="toplink.logging.level">FINEST</prop>
          </props>
        </property>
      </bean>Having read the documentation of the spring session scope I'm having a hard time explaining this behavior. As I understand it the EntityManagerFactory will be stored in the HTTP session resulting in a new EntityManagerFactory for each session. I cannot understand how this may result in that we are able to utilize the 2nd level cache? What are the relationship between the EntityManagerFactory and the 2nd level cache?
    Is this an accepted way of configuring the EntityManagerFactory or will there be a downside?
    I hope someone are able to explain this behavior for me:-)
    Best regards,
    Rune

    Hi Rune,
    To understand the shared cache behavior you actually need to understand more about what TopLink Essentials does than what Spring does. When a new factory is created, TopLink Essentials actually just proxies the server session with a factory instance, so the same server session is used. This is why you are seeing the same cache used across multiple factories of the same session.
    In the first case, if you are not using JPQL then what are you using to load the data and why are you thinking that it will not bypass the cache?
    Using a factory instance for each session is not what I would recommend doing as there are some additional costs associated with establishing a factory (even though the session already exists). The first way should be the correct way, I am just not sure what the circumstances are that are causing your cache to not be warmed. You may want to post more details about that so people can better help you out with that angle.
    -Mike

  • Problem with ADF Faces; Bean (session scope) keeps Data after Session ends

    Hi,
    I have a project, which was transferred from an myFaces-project to an ADF Faces-project. Since i´am working with the ADF Faces the data in my beans (which are all in session-scope) won´t vanish after a logout.
    1) I have a method in one bean, which clears the user data (name and passwd), for example, but after a logout (redirecting to the login-page) I just have to push the loginbutton to get in the app. as the last user logged in. The bean is cleared, but where does the data come from. When the app was working with myFaces, this did not happen, the inputText and the inputHidden were empty.
    2) I have a af:table, which displays max ten lines. If the last user watched the elements 21 to 30 in that table, the next user who watches the table gets the same elements shown and not the elements 1 to 10. That shouldn´t happen in a different session.
    3) I have some listboxes in one page, where a user can make some decisions. If i logout and in again, i can see the decisions last made in these listboxes.
    All that happens with beans in session scope!
    Thanks for the replies (i hope) and excuse my bad english,
    Santiago

    Hi
    If this is the case , you can explicitly make all ur session data objects null.

  • Session scope for component tree subtree

    I'm very new to JSF. Here is what I'm trying to do: I created a custom component, renderer, and tag. This custom action will always have children that are no custom, but whose rendering I must control (via encodeChildren, etc).
    The problem I have is that the CSS style of these components will change after they are rendered (DHTML & AJAX). Some are hidden, color changes, size change, etc. When I go to another page with the same custom action included, of course it just renders a new version with all of the changes lost.
    Now if this was a simple custom action with no children, I'd just create a managed bean with a value binding and there would be no problem. But what I am trying to do is save the ENTIRE subtree, ie. save the state of the custom component and all of its children also.
    Now the messy way to do this would be to take my component, make it a managed bean, then include a value binding every time I use that custom action. The custom renderer would look to the bean for how to render the children, etc. The problem I have with this approach is that I basically have to include attributes in my component (used as a managed bean) that redundantly describe the children.
    For example, my component:
    class UISearch extends UIComponentBase {
    private boolean showChild1;
    private boolean child1Color;
    etc..
    OR a better option, to have:
    private UIComponent child1;
    public setShowChild1() {
    child1.render = true;
    ....etc....
    The problem I have with the above aproach is that every time a page is requested, the UIViewRoot tree will be build, a new Child1 will be instantiated, and then during the rendering of UISearch's encodeChildren I'll have to pretty much copy over attributes..
    I wish there was a way that I could have a "managed component subtree" where UISearch and all of its children are instantiated once, held through session scope, and every time they are rendered, regardless of page, the existing, managed version is used.
    This sounds so obvious, and I am almost positive there is a way to do this, I just don't know how.
    Thank you!!!!!
    PS:
    I think I am on the wrong track. Basically all I want to do is have the UISearch and its children load the same normal way each time that they do now. I don't even care if the component tree is re-created, re-rendered, etc. But after this custom action is rendered, I call an AJAX loadConfig() type method that will return all of the style, innerHTML, src, etc. changes that must be updated.
    So my question really is.. what is the best practice for storing and retriving this information? I'm using DWR, and I'd like the loadConfig() to return an object with all the config stuff nicely organized.. so if the returned object is "search" and I need to load the 'display' CSS style for some child, i can do:
    child.style.display = search.history.clearHistoryLink.style.display;
    Who knows. Any and all ideas are welcome!
    Message was edited by:
    rrc3243

    I found example (bookstore) where I got answer about using backing bean in session scope.
    <!-- Backing Bean for bookshowcart.jsp -->
    <managed-bean>
    <managed-bean-name>showcart</managed-bean-name>
    <managed-bean-class>backing.ShowCartBean</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>
    <!-- Managed Bean -->
    <managed-bean>
    <description>
    Create a shopping cart in session scope the first
    time it is referenced.
    </description>
    <managed-bean-name>cart</managed-bean-name>
    <managed-bean-class>cart.ShoppingCart</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    ShoppingCart class don't have data properties like lastName or orderId
    Class have only somethings like this:
    protected BookDetails book() {
    BookDetails book =
    (BookDetails) context()
    .getExternalContext()
    .getRequestMap()
    .get("book");
    return (book);
    * <p>Return the <code>ShoppingCart</code> instance from the
    * user session.</p>
    protected ShoppingCart cart() {
    FacesContext context = context();
    ValueBinding vb =
    context.getApplication()
    .createValueBinding("#{cart}");
    return ((ShoppingCart) vb.getValue(context));
    * <p>Remove the item from the shopping cart.</p>
    public String remove() {
    BookDetails book = (BookDetails) item()
    .getItem();
    cart()
    .remove(book.getBookId());
    message(null, "ConfirmRemove", new Object[] { book.getTitle() });
    return (null);
    rule:
    Don't use backing bean with data properties in session scope!

  • Should we try to access session scope in ADF BC ?

    hi
    In the blog post "How to Access Session Scope in ADF BC "
    at http://andrejusb.blogspot.com/2012/01/how-to-access-session-scope-in-adf-bc.html
    Andrejus Baranovskis suggests it is no problem to access session scope in ADF BC using
    Map sessionScope = ADFContext.getCurrent().getSessionScope();But I wonder if this is really a good practice, as it looks very much like breaking the MVC pattern.
    At the same time I wonder where the Oracle documentation says this would be a good or bad idea.
    One starting point could be the ADFContext.getCurrent() method
    at http://docs.oracle.com/cd/E24382_01/apirefs.1112/e17486/oracle/adf/share/ADFContext.html#getCurrent%28%29
    that starts with saying "Gets the ADF context for the current thread. ..." which in a typical deployment scenario of ADF BC might not cause a problem.
    But, I wonder how defensive your programming should be when using the getSessionScope() method in your ADF Business Component code (that implements the Model).
    Ideas and feedback welcome.
    many thanks
    Jan Vervecken

    Hi Shay,
    Reviewing ADFContex methods it seems that this object shouldn't be accessible from BC. Example:
    public static ADFContext initADFContext(java.lang.Object context,
                                            java.lang.Object session,
                                            java.lang.Object request,
                                            java.lang.Object response)
        Initializes the ADFContext for the environment of the specified context.
        Parameters:
            context - the ServletContext or PortletContext of the current execution environment.
            session - the HttpSession or PortletSession of the current execution environment. OPTIONAL.
            request - the HttpServletRequest or PortletRequest of the current execution environment. OPTIONAL.
            response - the HttpServletResponse or PortletResponse of the current execution environment. OPTIONAL.
        Returns:
            the ADFContext that was current when init was invoked. Should be passed back to resetADFContext after the block requiring the ADFContext has completed.Kuba

  • Jsp:useBean : Missing value of String classed bean with 'session' scope

    Hi!
    I'd like to ask some help.
    I have these two JSP pages:
    1.jsp<jsp:useBean id="str" class="java.lang.String" scope="session"/>
    <html>
    <body>
    <% str="hello"; %>
    <a href="2.jsp">click</a>
    </body>
    </html>
    2.jsp<jsp:useBean id="str" class="java.lang.String" scope="session"/>
    <html>
    <body>
    <%=str%>
    </body>
    </html>When I open 1.jsp in my browser, then click on the link, the result is "nothing" (empty string). Why does the bean lose its value on the way?
    I use a Tomcat 5.5.9 server.
    Any help will be highly appreciated.

    You have to think of several scopes when working with JSP. The first is the local scope: the method _jspService() where all the work of the JSP is done.  This acts as a normal method and is where all the sciptlet code goes.
    When you use jsp:useBean you are creating two references to a new String object. One in the local scope accessible through <%= str %> and the other in the session scope.
    When you do <% str = "hello"; %> you are changing the local str variable to reference the String "hello" (this is equivalant to doing <% str = new String("hello"); %>). Only the local reference is changed, not the second reference in session.
    If you want the change to take affect, then you will have to store the new value in session with the same name:
    <% session.setAttribute("str", str); %>

  • How to remove session scope?

    Hi,
    I instantiated a bean using the JSP useBean tag and set its session scope to session. I want to at one point be able to remove the bean from session, how can I do this?
    regards
    Siliconbt

    you make the bean object null then u can remove the session.
    the above answer given in my view
    if any pls forward to me

  • Application scope objects(opinions wanted)

    Hi All
    Looking for educated opinions on the pros/cons of application scope objects. I am thinking about creating a read-only application scope hashmap representation of some static data in my database. When queried at the database level it can cause relatively long delays (3-4 seconds) and sometimes must be stored in many sessions on the server. I am thinking just one read-only object stored at app scope will cut down on the waste of memory, as well as skyrocket the speed of retrieving this data.
    Please give me your opinions!!! I can tell you a little more about the app if you need more info to make an educated statement...
    Thanks
    Greg B

    You can use the Properties Object for static data that can be persisted on a filesystem. Also, I assume that you can hold quite a bit of data too. A file read should be faster than a database query. Also if you do the connect once and save the connection for several reads, that works too. The only real slow operation, outside of large resultsets, would be the initial connect.
    I always design up two or three possible solutions and sometimes I protpotype each one. Sometimes one of the tests will prove to be the exact opposite choice of the one you thought would work.
    Now that I have written your response, I think that you could create a custom class to hold data, but would that not just be a copy of the properties object. If it's key/value you need, that's the choice.
    Stand back and ask, "What is the data type of the high level objects?"
    Also, SUN has good articles on almost everything in the JDK.
    David Whitehurst
    [email protected]

  • Session scope quary

    hi friends,
    i have a requrement to store FileItem(uploaded file using apache fileupload classes) objects in session scope using setAttrubute method.
    would it be reliable to store these objects in session scope, so that further i can retrieve it again without having any problem?
    is there any other solution?

    The HTTP session is visible within the context scope of an individual user. This means that the only time that an object wouldn�t be simultaneously accessed would be if the user opens a couple browser windows using the same encode session id in the URL�s and uses\submits them simultaneously.
    I guess that you could have the same distributed object EJB cache in session scope for two users but that should be handled for you by the EJB container.
    I suppose the WebSphere session management in the web container has an option to maintain a common session across applications based on the users authentication. I can�t see how this could be a good thing....
    You will want to cache objects in request scope when you don�t need to maintain state passed the request response lifecycle assuming that you are not using a heavy client caching system.
    Objects in session scope will persist until the session is invalidated or the browser session is terminated.

  • Session scope

    i am new in adf working on (11g) i try to set/get values in session scope i need at least tutorial
    like login page

    Hi,Mohamed
    You can set value to session scope by this code:
    FacesContext fc = FacesContext.getCurrentInstance();
    ValueExpression ve=fc.getApplication().getExpressionFactory().createValueExpression(fc.getELContext(), "#{sessionScope.username}", String.class);
    ve.setValue(fc.getELContext(),object);
    now there is a parameter in session scope its name is username* and its value is object*
    Sameh Nassar

Maybe you are looking for

  • Calendar entries entered on iphones not showing on computer

    My wife and I both have iPhones and sync them to the same instance if iTunes (same Apple ID).  We do not use iCloud for anything.  If either of us puts an entry into ical on one of the phones and we sunc our phones the entry gets transferred to the o

  • Siebel Tools Business Services for Source Control verification

    One of the challenges with integrating Siebel Tools with a Source Control repository is that it is far too easy for an user to check in code to the Siebel Repository without that code getting checked in correctly to the Source Control repository (i.e

  • Libobk.so --- 0 Bytes

    Hi, i've read the thread about the 0 byte libs but on my system sqlplus complains about the libobk.so which is a symbolic link to libdsbtsh8.so!!! Is there a patch for this lib ?? What did I wrong ? Thank you very much Michael null

  • Poor sound quality on some iTunes songs

    Downloaded some songs from iTunes and realized a really poor sound quality on some files. The worst example is "Precious" from "Depeche Mode" (Album version). It seems to me that the AAC file is encoded at a much too high level, so its overdriven and

  • New Design & Browser Back Button

    hi, am I the only one or is someone else experiencing a problem with the browser's BACK button since we have the new SDN design? If I click the BACK button there is an attempt to load something but the same page stays there. Only if I kind of double-