JSPs are servlets, so your book is misinformed.  The advised way to develop
J2EE apps is outlined in depth in the J2EE Blueprints doc.  Basically,
accessing EJBs directly from JSPs is sloppy.  You'll have all sorts of Java
gobbledygook mixed into your web-based presentation layer.  So the
recommendation is to follow the Model-View-Controller design pattern.

Model ~= EJBs
View ~= JSP
Controller ~= servlet(s) & JavaBeans and/or custom JSP tags

There are many possible ways to mix and match these.  One way is to hide all
the EJB connection and interaction in JavaBeans and use the standard JSP
bean tags to just get and set properties from the JavaBeans.  Another is to
do all the EJB interactivity in a servlet or in JavaBeans accessed by your
servlet, and populate the JSPs with responses from the servlet.  Another is
use JSP custom tags, which aren't much different from JavaBeans, but they
make the JSP tag language extensible and have some cool properties that
regular JavaBeans don't.  Finally, there are combinatory possibilities. The
Blueprints cover several possible scenarios.

Scott Stirling
Allaire Corporation
http://www.allaire.com/developer/jrunreferencedesk/

> -----Original Message-----
> From: Jorge Salas-Ortiz [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 14, 2000 3:37 PM
> To: [EMAIL PROTECTED]
> Subject: [EJB-INT] JSPs accessing EJBs
>
>
> Hello all,
>
> I recently read in an EJB book that JSPs can not
> access EJBs.  This book could be outdated. My concern
> is what would be the approach if I wanted to keep
> existing JSPs and not replace them with servlets
> because serlvets can access EJBs.
>
> I have read that wrapping EJBs in JavaBeans or simple
> classes is the way to go.  Does anyone have any other
> ideas or suggestions...
>
> thanks, jorge

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to