Vijayendra <br /> <br />"The harder you train in peace, the lesser you bleed in war"
Joined: Jun 13, 2004
so you mean to say that a bean is just a new name for a class. when you make application programs in java but do not intent to use it in web can i call that class a bean ? or a class can be called a bean only if im doin web apps ? and whats the use of a bean ? can you send me a sample project using beans ?
thnx in advance
Vijayendra V Rao
Joined: Jul 04, 2004
Originally posted by Leonardo Jr Go:
can you send me a sample project using beans ?
I think you should go through the EJB explanation in the J2EE turorials. I think this will help you a lot in clarifying many of your doubts.
Yeah Java Bean is nothing but a Java class and its a resusable component satisfying 3 conditions as per Sun specification.
1. A JavaBean need to be persistent. For that all JavaBean Classes need to implement Serialization.
2. Dyanamic Instantiated: Each JavaBean can be dyanamically instantiated. For this we provide a default constructor or no constructors at all.
3. Introspection: We will make all properties as private and provide mutator methods(set and get methods) to operate on those private properties.
The major difference between EJB and JavaBeans is EJB are distrubatable components. The idea behind developing EJBs is two applications running on different JVMs can talk each other. Where as JavaBeans are just resuable components.
Strictly a "JavaBean" is a concept created primarily for GUI building. The specification is here.
Since this the idea of a JavaBean was co-opted by the J2EE spec. people to describe a class which behaves roughly in the way Jagdish Reddy describes it. Except that the J2EE specification only mentions Enterprise Java Beans, and makes no mention of JavaBeans.
I tell you this because without knowing of the existance of the earlier definition, some documentation can be very confusing.
You can get an example project from Sun - look for the J2EE tutorial (which is also a good idea since it will help you understand what an EJB is).
To get you going - an Enterprise Java Bean is a component intended to be deployed in an EJB Container, which is used specifically for the purpose of developing so-called "Enterprise" applications. "Enterprise" is a bit of a marketing terms which is probably best summarised as: large, distributed applications. An EJB relies on the container's services to run. The container supplies services commonly needed by Enterprise applications, such as Transactions, clustering, security etc.
If you want to learn EJBs the best place to start is the tutorial link above. There are a whole raft of resource on the web too. Have a look at the documentation for a couple of the big Containers: Bea Weblogic,IBM WebSphere and JBoss. Bea's documentation in particular is pretty good. Also keep an eye on the EJB forum here - a lot of commonnproblems (and good answers) turn up in there. [ August 06, 2004: Message edited by: Paul Sturrock ]