JSP useBean, getProperty and setProperty tags

tutorial and example
tutorial and example

Java bean is a special type of Java class that contains private variables and public setter and getter methods. Java bean class implements Serializable interface and provides default constructor.

JSP allows you to access the Java beans in JSP files. To invoke Java bean, useBean action tag is used and to access the properties of Java beans, JSP setter and getter method is used.

Example of useBean Tag

In this example, setproperty() and getproperty() method is used to set and get data of current Java class.

EmployeeBean.java

index.jsp

Output: