470,815 Members | 1,471 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

session attribute copied to new session

I want to use session attributes to save info on a user who wants to
navigate my site. When the user logs in I use:

HttpSession sess = request.getSession(true);
sess.setAttribute("customer", customer);

where customer is an object I have instantiated earlier. This works
fine and I can view values from this object using the following code
in index.jsp:

CustomerBOImpl cust = null;
if(session.getAttribute("customer") != null){
cust = (CustomerBOImpl)session.getAttribute("customer");}
out.println(cust.getFname());%> <%out.println(cust.getLname());

This prints out the first name and last name just fine. The problem
comes when someone else tries to access the same index.jsp. It opens
up the page, gives them a separate session ID, but this different
session contains the same customer object of the last person who
logged in.
My question is: What is the proper manner to set session attributes
and then retrieve them in a JSP servlet?
Jul 17 '05 #1
0 2863

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by alien2_51 | last post: by
2 posts views Thread by Patrick | last post: by
8 posts views Thread by bdeviled | last post: by
3 posts views Thread by bennett | last post: by
reply views Thread by T Ralya | last post: by
4 posts views Thread by Gary | last post: by
2 posts views Thread by Michaelk | last post: by
5 posts views Thread by =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.