Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpSession and Session Bean

 
Kalpana Balasubramanian
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone please clarify me this question.
Whether the userstate maintained in HttpSession can be made avaiable in EJB Stateful/Stateless session bean?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the EJB doesn't have direct access to the HttpSession but you can pass the session to the EJB as a parameter (assuming everything in it is Serializable). Not a good thing to do though, since it ties your EJB method to a web client and any cahnges your EJB method makes to the HttpSession will not be reflected in the actual HttpSession itself.
[ March 19, 2007: Message edited by: Paul Sturrock ]
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So in that case, you would have to get the stuff out of the HttpSession, put it into some other class that you create, pass that to the EJB, do stuff, and put the changes into that new class, return that, then take it out of that object, and put it into the HttpSession.

Mark
 
Kalpana Balasubramanian
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help.

I did that way only, I created a User class which is passed back and forth with the updated information. It is working fine.

Thanks again!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic