• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EJB - access existing stateful session bean

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everibody
I have a stateful session bean that initializes a Collections.synchronizedList, I add products to the list and check the list, it works(all during the same session). But when I restart the browser it doesn't show me the list.

After watching the console I have discovered that the bean is created again.
In my code i can access my bean only if i'm in the current http session.. and it doesn't work properly
Here is the code in my Servlet:



if i can't find my bean i instantiate a new one via lookup..
but how can i access an existing bean?
without creating a new one each http session?

 
Ranch Hand
Posts: 138
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since the stateful bean is stored in session, it itself means it is meant for the current session of any user.
You cannot expect to get the bean if the session is newly created.
 
Antonio Foglia
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Prajakta Acharya wrote:Since the stateful bean is stored in session, it itself means it is meant for the current session of any user.
You cannot expect to get the bean if the session is newly created.


Can i use javax.servlet.http.Cookie to save mi session data?
reply
    Bookmark Topic Watch Topic
  • New Topic