Jsp:useBean, jsp:setProperty and jsp:getProperty action tag
jsp:useBean action tag:
jsp:useBean action tag is used to instantiate a bean class. It first search for an existing instance using id and scope variables. If object is not found than it creates bean class object.
Commonly used attributes of jsp:useBean:
1. id: This attribute is used to uniquely identify the bean class within the specified block.
2. scope: This attribute represents the scope of the bean. Scope may page (default scope), request, session or application.
3. class: This attribute specifies the full package name of the bean.
Syntax:
jsp:setProperty action tag:
jsp:setProperty action tag is used to set the value of the specified bean property.
Commonly used attributes of jsp:setProperty:
1. name: This attribute refers to the bean class.property: This attribute specifies the bean property whose value is to be set.
2. value: This attribute specifies the value set to the bean property.
Syntax:
jsp:getProperty action tag:
jsp:getProperty action tag is used to get the value of the specified bean property and insert it into output.
Commonly used attributes of jsp:getProperty:
1. name: This attribute refers to the bean class.
2. property: This attribute specifies the bean property whose value is to be retrieve.
Syntax:
Syntax:
Example:
test.jsp
StudentBean.java
display.jsp
web.xml
Output:
Enter Name and RollNo:
Click on Sign up button: