(Jsp: useBean) Usage

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.