Jsp Beans known as a property attribute that is been used for the accessing the user of object the content may be java class or package that is been used to access the class field of object.
In simple words if we explain jsp beans this attribute use to access the property from a class file file must be java type or other as mentioned. In this example we use to display the property on the web browser we made a package named ‘p1’ in this we made a java file which class file will be use to access the data. In java file we create a program that is been use for getting and putting the value from property contents. Then we create a jsp file that will use the class file of java type while executing for output on the web browser. Attributes that are use to initialize like set property or beans id…let’s take a look on program.
<%@page import=”p1.jspbean”%>
<html>
<head>
<title><jsp_bean></title>
</head>
<body>
<jsp:useBean id=”bean” class=”p1.jspbean”>
<br><h3 align=”center”><jsp:setProperty name=”bean” property=”str” value = “Java Server Pages” /></center></br>
</jsp:useBean>
<p> <jsp:getProperty name=”bean” property=”str” /></p>
</body>
</html>
Java File used In Program.
package p1;
public class jspbean
{
String str;
public String getStr()
{
return str;
}
public void setStr(String str)
{
this.str = str;
}
}