wood burning stoves*
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
Author

Java Bean

shiva shankar
Ranch Hand

Joined: Jun 10, 2001
Posts: 84
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.
Regds
Shiva
Murilo Beriam
Greenhorn

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: 84
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.
shiva
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: http://aspose.com/file-tools
 
subject: Java Bean