Introduction
Jsp: useBean action is used to load a JavaBean that will be used on the JSP page. This function is very useful because it enables us to take advantage of Java Component Reuse and avoid the loss of JSP convenience.
Syntax:
Id: JavaBean reference name
Class: class used to specify the JavaBean
Scope: Specifies the scope of the JavaBean. By default, scope is set to page.
The setProperty action is used to set the attribute value of the specified usean in useBean. The setProperty Action specifies the name, attribute, value, and parameter, which is used to assign the attribute to the JavaBean. The setProperty action syntax is as follows.
Syntax:
Name: Specifies the id of the usean used in useBean.
Property: name of the JavaBean attribute for which you want to set the value
Value: Specifies the value to be set for the attribute.
Param: Specifies the name of the form Element Used to input data and assigns a value to the attribute.
Note: The param attribute cannot be used with the value attribute.
After assigning values to the property specified by property through setProperty for the object specified by the id in useBean, you can use the getProperty action to obtain the attribute value specified in JavaBean.
Syntax:
Name: Specifies the id of the usean used in useBean.
Property: Specifies the attribute name of the JavaBean to be obtained.