Accessing EJB's from JSP's

Discussions

EJB design: Accessing EJB's from JSP's

  1. Accessing EJB's from JSP's (2 messages)

    I'm trying to access the stateful session bean from the jsp pages.Will the App Server treat the webserver as a single client or each Jsp page as a single client?
    If it is going to treat the webserver as a single client then how the state between multiple jsp pages can be maintained?

    Threaded Messages (2)

  2. Accessing EJB's from JSP's[ Go to top ]

    hi priya
    well each request to the server will be considered as single client and if your bean is a satteful session bean then you need not worry b'coz you bean it self takes cares of passing the sessionid to different pages which maintains the session until the session time out occurs(default value set in the server)otherwise if your session bean is stateless then you have to take care of passing the values to different JSPs as http session values
    i hope u r clear now
    all the best
    ram
  3. Accessing EJB's from JSP's[ Go to top ]

    Hello,

    These are my thoughts about this.

    First thing is that the application server doesn not need to know whether the client is a jsp running in a web server or stand alone java application or anything.

    In this context, we are using JSPs and stateful session beans. In each JSP if you do home.create() then you will get a differnt instance of EJBObject for stateful session bean. But this is not what we want.

    What you can do is create EJBObject for stateful session bean using home.create() and put it in web server session for each user.
    When a request come next time, you just get the EJBObject from the web server session and access the same stateful session bean.
    This way each user will become a different client for stateful session bean rather than whole web server is just one client to the stateful session bean.

    Friends, any other thoughts about this???

    Regards,
    Ravi Sankar Pabbati
    GE India