GeeCON Prague 2014*
The moose likes EJB and other Java EE Technologies and the fly likes Doubt in Java Beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Doubt in Java Beans" Watch "Doubt in Java Beans" New topic
Author

Doubt in Java Beans

srinibash udayasingh
Greenhorn

Joined: Jul 09, 2007
Posts: 22
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

Joined: Oct 17, 2001
Posts: 153
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.


Shailesh Kini.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in Java Beans