• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on storing Shopping controller in session

 
Dhiren Joshi
Ranch Hand
Posts: 463
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In PetStore , there is the shopping controller which is stored in the http session by the component manager.
Here the session is used to store the shopping controller but at the same time the shopping controller is a SFSB.

Cant we remove one of the state mechanism and use only either a SFSB or just in http session ..

What advantage does Pet store get from using this strategy ..





Thanks
Dhiren
 
Stefan Zoerner
Author
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

Just some ideas:

The SFSB bundles state (content of the cart) and functionality (e.g. adding items to the cart) in a component. I do not think that it is a good idea to use the HTTP session to save items of the cart without a comparable abstraction of the cart.

It would be possible to use a JavaBean component for this (instead of the EJB) and store it as an attribute in the session. But you have several advantages from the SFSB (and some drawbacks, it is a trade off), e.g. SFSBs provide passivation.

Greetings from Hamburg,
Stefan
 
Dhiren Joshi
Ranch Hand
Posts: 463
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Stefan,
Let me add ,
The shopping controller is stored in a http session.
Shopping controller a SFSB calls undercovers the facadeShoppingclient which is a SFSB and that calls the shopping cart which is a SFSB as well.
I dont understand the advantage of storing the controller in the session since the controller is already a SFSB.
Basically storing the handle of the EJBObject in the session at the web tier.
Doesnt a servicelocator do just that then why add another layer for retrieving it from the httpsession.
Dhiren
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic