• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Bean

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Farmers know to never drive a tractor near a honey locust tree. But a tiny ad is okay:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic