2 Replies Latest reply on Jan 19, 2010 4:40 AM by jsf geeks

    Page scope & Session variable Conflicts

    jsf geeks Master

      Hi all,

       

              I am developing my application in Richfaces using Netbeans 6.7.1. In one of my pages, I set page scope as session. But the problem with this is, if in that page(back bean) I set Attribute in session, and again after some event I try to get that Attribute back from the session, but it shows that there is no value in the session (it gives nullPointerException).

       

             Can anyone tell what's wrong with it. I need page scope to be set as session.

       

      Thanks in advance,

      JSF GEEKS

        • 1. Re: Page scope & Session variable Conflicts
          liumin hu Master

          what is exactly the scope of your backingbean? i dont use netbean. but you can find it in facesconfig.xml under web-inf directory.

          • 2. Re: Page scope & Session variable Conflicts
            jsf geeks Master

            Hi liumin hu,

             

                 I appreciate your support, but I mentioned my backing bean scope (Page scope) in my questions. It's ok. I again tell you that my backing bean scope is session. So I have a backbean with session scope(in faces-config.xml) and I am using HttpSession to put values in session for later use, like,

             

            session.setAttribute("session_variable", "value_to_put_in_session");

             

                And using it later or at some event like,

             

            Object obj = session.getAttribute("session_variable");

             

            But, sometimes it happens that I may not get the value from session ( session returns null ), even if I set the value in session.

             

            I think my question is clear to you, now. If any query, then feel free to ask me again.

             

            Thanks again for your support & time,

            JSF GEEKS