File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Java Bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Java Bean" Watch "Java Bean" New topic

Java Bean

shiva shankar
Ranch Hand

Joined: Jun 10, 2001
Posts: 85
In what way is a Java Bean advantageous. Apart from the demarcation that it is a component, does it have any other special features.
I wish to know one more thing. A java Bean is a typical class. Won't it have the same too many object instatiation as a typical class. What are its major advantages as far as the threading issues are concerned.
Murilo Beriam

Joined: Jul 16, 2002
Posts: 6
A java bean is a simple data structure which is responsible for carring data and not complex logic. You should determine the rules for getting and setting attibutes but nothing beyond this. Coding this way, the final result will show lots of classes with the responsibility well distributed. Each class has its own role in the system and data structure is the java bean responsibility. It's like a style of coding.
There are some advantages using these beans, like the built-in facilities in the servlet engine.
Think of the use of the tag jsp:useBean, for instance. It is really useful.
shiva shankar
Ranch Hand

Joined: Jun 10, 2001
Posts: 85
How about the object creation issues. Aren't they created as a simple java class does. That could be heavy if the hits are more compared to a servlet.
Sandep Chaturvedi
Ranch Hand

Joined: Aug 20, 2002
Posts: 49
Oh yes, there can be serious bottlenecks if javabean is not coded correctly and scope is not setup appropriatly. You can store ton of info in the instance variables and instantiate for every request. It can even bring the server down.
Ideally Java bean should not be more than a value object with getters/setters with all business logic delegated to a helper class/ejb.
I agree. Here's the link:
subject: Java Bean
It's not a secret anymore!