Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB and JavaBeans?  RSS feed

 
Nick Ueda
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a difference between EJB's and JavaBeans or are these the same thing?
When people talk about Bean development in JSP pages are they talking about EJB's or JavaBeans?
If there is a difference what is it?
Thank You So Much,
Nick Ueda
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaBeans are plain old Java objects, Enterprise JavaBeans are container managed, remotable, transactional, etc etc. components (not just "objects"!).
If you hear people talking about "beans" related to JSP pages, you really can't say which one they are really talking about unless you know something about the "coding standards" of the project -- JavaBeans are most often used in JSP pages but (unfortunately perhaps) I've seen people calling EJBs from JSP pages as well.
 
Nick Ueda
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lasse Koskela:
(unfortunately perhaps) I've seen people calling EJBs from JSP pages as well.

This is a bad thing?
please explaing why...
Also...are EJBs syntactically different or more complicated than "plain old" JavaBeans?
Thanks,
Nick Ueda
[ June 22, 2003: Message edited by: Nick Ueda ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Calling EJBs from a JSP is generally a bad idea, but not always. I'll try to draw some lines here.
The fact that a JSP (presentation) is calling an EJB (business logic) makes the application tightly coupled in the sense of not fulfilling an MVC architecture. It's generally considered better to separate the presentation layer and the business logic layer with a controller layer (usually servlets and plain old Java classes).
But, in some cases it is indeed acceptable and even recommended to drop the middle layer and ignore the tight coupling. This is true for smaller applications or applications with less expected maintenance burden later on in the application's lifecycle.
Then how do EJBs differ from JavaBeans? JavaBeans are light-weight components while EJBs are, as their name implies, heavy-weight components intended for more advanced processing. EJBs add to plain JavaBeans things like security, transactions and remoting, neither which are provided (nor needed) by regular JavaBeans.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!