• 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

Use of JavaBeans

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

Regards
bala
 
Ranch Hand
Posts: 464
Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai,
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
}
}

Regards
Venkatesh S
 
reply
    Bookmark Topic Watch Topic
  • New Topic