• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

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: 8943
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.
 
Run away! Run away! Here, take this tiny ad with you:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic