JSP syntax
Name = "beaninstancename" { Property = "*" | Property = "PropertyName" [param = "parametername"] | Property = "PropertyName" Value = "{string | <% = expression%>}" } /> example Description / R You can use a variety of ways to use Match the properties in the bean by all values entered by the user (in the Request object in parameter storage) Match the attribute specified in the bean by the specified value input by the user. Use an expression when running to match the properties of the bean Each method of setting attribute values has its specific syntax, below we will explain Property and its usage Name = "beaninstancename" Represents the name of the bean instance created in Property = "*" Store all values for the user in the JSP input to match the properties in the bean. The name of the attribute in the bean must match the parameter name in the Request object. The parameter values transmitted from the customer to the player are generally character types, which must be converted to other types in the bean, and the type of bea property and their conversion method are listed in the table below. Transform strings into other types of methods. Property type method Boolean or Boolean Java.lang.Boolean.Valueof (String) Byte or byte Java.lang.byte.valueof (String) Char or Character Java.lang.Character.Valueof (String) Double or DOUBLE Java.lang.double.valueof (String) Integer or Integer Java.lang.integer.Valueof (String) Float or float Java.lang.float.Valueof (String) Long or long Java.lang.long.Valueof (String) If there is an empty value in the parameter value of the Request object, the corresponding bean property will not set any values. Similarly, if there is an attribute in the bean without the corresponding request parameter value, then this attribute does not set .property = "PropertyName" [param = "parametername"] Use a parameter value in the Request to specify an attribute value in the bean. In this syntax, Property specifies the property name of the bean, and param specifies the parameter name in the request. If the bean property is different from the name of the request parameter, you must specify Property and Param if they are the same name, then you just need to indicate that Property is fine. If the value is empty (or not initialized), the corresponding bean property is not set. Property = "PropertyName" Value = "{string | <% = expression%>}" Use the specified value to set the bean property. This value can be a string or an expression. If this string, it will be converted to the type of the bean property (see the above table). If it is an expression, then its type must be consistent with the type of attribute value to be set. If the parameter value is empty, the corresponding attribute value will not be set. Also, you can't use Param and Value in a skill If you use Property = "*", then bean's properties are not necessary to sort in the order in the HTML form. 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 / R 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 to distinguish between different beans in the later program. This variable name is sensitive to case, and must meet the scripting language you are using, in Java Programming Language, this rule has been written 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.