how can get session object's of web tier in EJB

Discussions

EJB design: how can get session object's of web tier in EJB

  1. how can get session object's of web tier in EJB (5 messages)

    Hi
    I face prob.. where i want to get session contents from my
    web tier please sugg.. me how i can play with session object
  2. The best way to do this is to pass the objects as method parameters from your Web Tier to your EJB tier.


    Object value = session.getAttribute("value");
    ejb.ejbMethod(value);


    This is probably not the answer you were hoping for, but if you want good seperation of tiers, it is your only option.
  3. thanks
    but do u think I should import web tier session API in EJB ?
  4. thanks

    > but do u think I should import web tier session API in EJB ?


    No.
  5. iI do't think this is soln..
  6. Race Condition is right. Importing the servlet session in your EJB layer will almost certainly fail to work. Pass your data between tiers explicitly as method parameters.

    If your really must pass the entire servlet session between your tiers, store all your servlet session data in a Map, and pass this entire map between your tiers. But I am sure if you spend more time thinking about your design, you can come up with something better than that.