This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread 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 Android Security Essentials Live Lessons this week in the Android 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
Similar Threads
How to create a static class
sorting double nodes
Metadromes in Java
Java code help!
import JSP table to excel