JSP Tutorial

Java Bean in JSP

Java Bean in JSP

A JavaBeans class is a software reusable component. Every JavaBeans class must belong to a package. Since, it is reusable. Every JavaBeans class modifier must be public. Every JavaBeans class must contain set of data members (known as properties).

For each and every data member of JavaBeans class we must have set of set methods whose general representation is:

public void setXxx (datatype FormalVariableName)
{
..........;
..........;
..........;
}

For each and every data member of JavaBeans class we must have set of get methods whose general representation is:

public datatype getXxx ()
{
..........;
..........;
..........;
}

The set of set methods are used for setting the values to JavaBeans class object whereas set of get methods are used for getting the values from JavaBeans class object.