• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

how to deal with session if you have both servlet and EJB ?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if I only have servlet/jsp, I can use HttpSession to save the objects in there, easy. Now for the following scenarios---

1. servlet only talks to STATELESS session beans. In this case, I can just keep using the HtppSession I have in the servlet because the EJB part doesn't need any session information, is that right ?

2. servlet talks to STATEFUL session bean and stateful session beans talk to entity beans. Then how to I "pass" the HttpSession I have in the servlets to those STATEFUL session beans ? This case often happens when I let users pick certain thing on web pages and these info is stored in the httpsession, then session beans are called, how to handle the session now ?
 
Ranch Hand
Posts: 8953
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

2. servlet talks to STATEFUL session bean and stateful session beans talk to entity beans. Then how to I "pass" the HttpSession I have in the servlets to those STATEFUL session beans ? This case often happens when I let users pick certain thing on web pages and these info is stored in the httpsession, then session beans are called, how to handle the session now



When you access the SFSB(Stateful Session bean)for the first time store the Handle of the business (EJBObject) in the HttpSession. When the same user makes another request and the SFSB needs to be invoked retrieve the handle from the Httpsession, get the EjbObject from the handle and invoke the method.
 
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic