Hi friends
I want to know that want is the concept of java beans in java. please explain it with example.
Thank you.
Java Beans in Java
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Apr 20, 2012, 4:17 AM EDT
Java bean: It is a development component for performing a task in an application. Any ordinary java class with a set of variables and methods can be called as javabean. The methods present in a java bean must follow a naming convention. A java bean can be used in a web application to store the state of the users.
Creation process of a java bean:
1. Create a class in a package as the bean class.
2. Provide the required variables as the properties.
3. Provide setter and getter methods for each of the variables.
4. Store the package folder inside a classes folder.
5. Compile the file as ordinary java file.
Store the following bean file in (E:\Servlet\WEB-INF\classes\pack1)
Example:
package pack1;
public class mybean
{
private String name,pass;
public void setName(String n)
{
name=n;
}
public void setPass(String p)
{
pass=p;
}
public String getName()
{
return name;
}
public String getPass()
{
return pass;
}
}
Compile of bean:- javac mybean.java
Please refer the below link
http://www.c-sharpcorner.com/uploadfile/satyapriyanayak/creation-of-a-java-bean-and-how-it-is-used-in-java-server-pages/default.aspx
Thanks