• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in Java Beans

 
srinibash udayasingh
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers

What is need of beans.we can also create other class to get and set values.
Then what is the need of get and set methods.can please explain it using some realtime example.

Thanks

Srinibash
 
Shailesh Kini
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

JavaBeans Specification emerged from AWT/SWING frameworks. It defines a standard way of how your encapsualted data should be set or retrieved from an object.

Getter and setter methods were created so that any engine/framework could query for the data dynamically without knowing about the object's methods.

JavaBean specification has also been extended to Java EE. A good example is JSP page using a useBean tag. The bean has getter and setter methods and the jsp container displays/reads the properties and renders the page dynamically for you.

You could refer to petsore web application or any Java Swing sample application to get a better understanding of java beans.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic