This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes EJB and other Java EE Technologies and the fly likes Use of JavaBeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Use of JavaBeans" Watch "Use of JavaBeans" New topic

Use of JavaBeans

Balachandar Nayak

Joined: Jul 22, 2005
Posts: 29
Dear all

Im learning J2EE and Im a beginner
What is JavaBean?
What is the use of the getter and setter functions
described in the Bean?
How it is used to transfer data from a GUI and a database?
Kindly response to my question.

Thanks in Advance

S Venkatesh
Ranch Hand

Joined: Jun 27, 2005
Posts: 464

You can consider the javabean as a simple java class.It can be described with the follwoing elements.
1. All the variables in this class are private variables.
2. All these variables have corresponding getter and setter methods.
3. It may also contain a equals(object obj) method.

Ex: (I have not compiled the class)
public class Login{
String userName;
String password;
public void setUserName(String userName){
this.userName = userName;
public String getUserName(){
return this.userName;
public void setPassword(String password){
this.password = password;
public String getPassword(){
return this.password;
public boolean equals(Object obj) {
//you can check if the obj elements matches your bean elements
//and return true otherwise return false

Venkatesh S
I agree. Here's the link:
subject: Use of JavaBeans