tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Melissa Matthews <meli...@cendex.com>
Subject Problems with session variables
Date Thu, 15 Feb 2001 23:41:23 GMT
I am using Tomcat 3.2.  I seem to be losing some of the session variables
(or keeping old values) between JSP pages.  I have even tried
removeAttribute to remove the old values and then setAttribute to save the
ones.  Some of them are saved, but not others.

Here is the segment where I save the variables ====>

   // Remove the old values from the session
   String oldValue = (String)session.getAttribute("person_id");
   if ( oldValue != null )
   {
      session.removeAttribute("person_id");
   }
   oldValue = (String)session.getAttribute("firstName");
   if ( oldValue != null )
   {
       session.removeAttribute("firstName");
   }
   ....

            
   // Add the new session values
   session.setAttribute("person_id",person_id);
   session.setAttribute("firstName",firstName);


Here is where I retrieve the values ===>

   session = request.getSession(false);
    String person_id = (String)session.getAttribute("person_id");
 
   if ( person_id != null )
    {
       String firstName = (String)session.getAttribute("firstName");
      
       if ( firstName != null )
       {
             ......
       }
   }

The person_id is correct, but the name remains the old name.    I have tried
encoding the URL, initializing the session etc.


Any suggestions?




Mime
View raw message