I think you're mixing paradigms here.  EJBs are just objects.  Entity beans
represent data objects, while session beans represent actions.  You can
store the data retrieved from entity beans with the servlet context (if
you're writing server-side apps) or in a globally accessible variable (say,
a static variable to an application context class) for a client-side
application.  Stateless session beans are transient, so you really don't
need to "store" them.  Stateful session beans are valid until timeout, and
the application is responsible for storing handles to them.

I suppose JNDI could be thought of as a "context" for looking up EJBs.  But
that's not really analogous to a context from the servlet & JSP world.  It's
not an application context.  Instead, I guess you could think of it as an
EJB container context.

If you're doing server-side programming, and want an application context to
store data retrieved from EJBs (or you want to store a primary key to an
entity bean or something), you can simply use the servlet context.  EJBs are
objects that can be used by a servlet.

Since HTTP is a stateless protocol, there is not consistent data space for
variables that is valid across multiple requests.  As a result, servlets
(and JSPs) introduce the concept of contexts.  These are merely persistent
storage for variables that persist across multiple requests.

If you require such a variable space for your EJBs in a server-side
application, then just use the servlet contexts.  If you're building a
client-side app, then you can create your own "context" to store these
variables.

So, getting to your last sentence, if you want a common area for variables,
then just use whatever common area you would have used before you wrote
applications using EJBs (i.e. contexts for server-side applications, static
variables for client-side applications).

I hope that clears things up.

-dan

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Hunter
Hillegas
Sent: Friday, June 01, 2001 7:09 PM
To: JBoss 2
Subject: [JBoss-user] The Notion of an "Application"


I am coming to EJB from the world of Servlets+JSP... In that arena you have
a context for the scope of a whole application. You can put stuff there that
you can access from any of your servlets, jsp's, etc...

Is there such a notion of that for an EJB app (not counting the Web layer)?

There are some things that would be useful to store in a common "area" like
configuration values, debug settings, etc...

Hunter


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to