I have had good luck with a similar design.  Here is what I do in cases like
this.  Most of this was found by reading articles / books and trial and
error.

In a JSP file I use the "useBean" to create / find a bean that resides in
the same VM as the servlet engine.  This bean follows the command pattern.
When it is executed it creates a session bean (on the EJB container), pushes
the data into the session bean, and generally interacts with it.  Most
likely the session bean updates some of its instance variables during this
time.  Just before the execute is completed, the command class pulls the
variables back into it (refreshed).  At critical moments the session bean
may have interacted with entity beans, if necessary.

The command classes never talk directly to entity beans (perhaps bypassing
imporant business logic) and the JSPs never talk to anything except the
command classes.

The command classes provide a tidy place to handle all of the JSP data
conversion requirements; like converting the information to and from string
representations.  It also allows you to control the communication to the EJB
container.  For instance, all of the data could be sent (or retrieved) in
one message send.

The session beans are a good place to put all of the business logic.

The entity beans are a good place to handle all of the data mapping issues.

Has anyone had experience implementing this pattern on a large scale? (large
volume?)

-----Original Message-----
From: Hunter Hillegas [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 16, 2001 1:03 PM
To: JBoss 2
Subject: [JBoss-user] Design Question


Okay... Starting the design on my first ever EJB/JBoss project. It's only
going to be accessible via the Web...

I want to make sure I make an educated decision on the design.

This is what I'm thinking:

Requests come in via a servlet, which invokes methods on a stateless session
bean that uses CMP entities to create details objects, which are placed in
the request scope for JSPs to display.

For parts of the site that are transactional, input will be received by the
servlet then fired off to the appropriate stateless session beans and then
to the entities as necessary.

Any major flaws in this generic description? It seems to be similar to what
sites like TheServerSide.com have implemented but since I've never done this
before, I may be misunderstanding something basic. It seems like creating
read-only details objects are the best way to push content out to the JSPs
for display. Is there another approach (besides calling entities directly -
this seems way too expensive) that I am ignoring?

Hunter



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

Reply via email to