Create a bean instance and specify its name and scope.
JSP syntax
ID = "BeanInstanceName" Scope = "Page | Session | Application" { Class = "package.class" | TYPE = "package.class" | Class = "package.class" type = "package.class" | Beanname = "{package.class | <% = expression%>}" type = "package.class" } { /> | | > Other Elements jsp: usebean> } example jsp: usebean> description For positioning or examples of beans, Try to locate a bean by a given name and scope. Reference variables for this bean object are named in the name you specify. If this bean is found, this reference will be stored in this variable. If you also specify a type, this bean is also set to the corresponding type. If this bean is not found, it will be sampled from the class you specified and this reference is stored in a new variable. If the name of this class represents a template, then this bean is sampled by java.beans.beans.instantiate. If Properties and usage ID = "BeanInstanceName" Confirm the parameters of the bean in the range you define, you can use this variable name in the later program to distinguish between the variable names for large-sink, must meet the scripting language you use, in Java Programming Among the Language, this rule has been stated in the Java Language specification. If this bean is created in other Scope = "Page | Session | Application" The range of beans exists and the valid range of the ID variable name. The default is Page, the following is a detailed description: Page - You can use Beans in the JSP file containing Request - You use bean in any JSP file that performs the same request until the page is executed to respond to another file or go to another file. You can use the Request object to access bean, such as request.getattribute (BeanInstanceName) Session - From Creating a bean, you can use the bean in any JSP file using the same session. This bean exists within the entire session survival cycle, any JSP file in sharing this session can use the same bean. Note that you create BEAN's JSP file must specify session = true in the <% @ Page%> instruction Application - From Creating a bean, you can use the bean in any JSP file using the same Application. This bean exists within the entire Application Licheng period, any JSP file in sharing this Application can use the same bean. Class = "package.class" Use the new keyword and the Class constructor from a class from a class. This class cannot be abstract, there must be a public, no parameter constructor. This package is subject to case. TYPE = "package.class" If this bean already exists in the specified range, write this bean a new database type. If you don't use Class or BeanName to specify Type, Bean will not be sample. Package and Class's name, case sensitive. Beanname = "{package.class | <% = expression%>}" type = "package.class" Use the java.beans.beans.instantiate method to sample a bean from a Class or continuous template while specifying the type of the bean. Beanname can be Package and Class or an expression, it will pass the value of Beans.instantiate.TUPE can be the same as beans. Package and Class name are case sensitive.