Bean tags
The main role of the JSP custom label in the Struts-Bean tag library is to access the properties of beans and beans, as well as these accesss to define new beans, allowing the page to access these beans through script variables and attributes within the page.
Cookie
The role of the cookie tag is to get the specified cookie's properties value and define it a script variable.
When there is a problem in the label (such as the set cookie variable is not found, and the value attribute is not set), a request period will throw an exception.
This tag cannot be labeled.
This tag has four properties.
Attributes
description
Id
Specifies the name of the script variable (also the attribute name within the page range), the variable or attribute represents the value of the requested cookie
(have to)
Multiple
If the value of this property is set to any value, then any matching cookie will be integrated into a bean with javax.servlet.http.cookie []. If the property is not set, the first matching cookie will be acquired, stored in the bean of Javax.Servlet.http.cookie.
(Optional)
Name
Specify the name of the cookie used to get the attribute value
(have to)
Value
The default attribute value, if there is no matching cookie, this property will be stored into a type of javax.servlet.http.cookie.
(Optional)
Define
The DEFINE tag is to get an attribute of the specified bean and define it as a bean, and exhibit this bean by script variable, which will be stored in the specified scope.
When there is a problem in the tag (such as the specified bean is not found, and the value attribute is not set), a request period will throw an exception.
This tag can contain JSP tag contents.
This tag has seven attributes,
Attributes
description
Id
Specifies the name of the BEAN script variable, which is valid within the specified scope, which can be used to obtain the corresponding attribute value.
(have to)
Name
Specifies the name of the bean that gets the property value. This attribute is required, unless you set the value attribute.
(Optional)
Property
Specifies the name of the property name in the acquired bean, the name of the bean is set by the Name. If the property is not set, the value of the script variable is obtained from the corresponding attribute of the bean obtained by the Name property via the ID attribute.
(Optional)
Scope
Specifies the scope of the BEAN for obtaining the attribute, if no settings will be found in the following order, will look for Page, Request, Session, and Application.
(Optional)
TOSCOPE
Specifies the script variable scope, the default value is Page.
(Optional)
Type
Set the full class name of the type that is displayed in the id attribute name. By default: If the Value property is set, it is java.lang.string, other cases is java.lang.object.
(Optional)
Value
The value of the java.lang.string type sets the value of the defined bean. This attribute is required when there is no NAME attribute.
(Optional)
HEAD
The role of the HEAD tag is similar to the cookie tag, and the difference is only the HEAD tag is used to get data from the head, not from the cookie.
When there is a problem in the tag (such as the specified head attribute is not found, and the value attribute is not set), a request period will throw an exception.
This tag cannot contain label content.
This tag has four properties.
Attributes
description
Id
Specifies the name of the script variable (also the attribute name within the page range), the variable or attribute represents the value of the headed HEAD (must)
Multiple
If the value of this attribute is set to any value, the httpservletRequest.getHeaders () method will be called, and the return value is packaged as a String [] type bean. If there is no setting or set to null, the httpservletRequest.getHeaders () method will be called, and the return value will be packaged as a String Bean.
(Optional)
Name
Specify the name of the http head attribute
(have to)
Value
The default attribute value, this property will be used if there is no matching HEAD.
(Optional)
Include
The role of the include tag is to introduce the web application resource and get the result, which makes the response data as the String type object. The role of the label is quite similar, except that in this TAG responds to the object properties stored with a page range.
This tag supports three types of resource components: Forward, HREF, and PAGE.
When there is a problem in the tag (such as the set resource component does not exist), an exception is thrown.
This tag cannot contain label content.
This tag has seven attributes.
Attributes
description
Id
Specifies the script variable of the scope to Page, which is used to access the value of the resources of the web application.
(have to)
Anchor
Set the HTML Anchor tag that will be added to the last generated URL. When setting it, you do not need to contain a # character in the setting string.
(Optional)
Forward
Used to find a global ActionForward, through the configured lookup, the actual URL related to the context of the resource that needs to be introduced is finally obtained.
(Optional)
HREF
Absolutely demand the URL address of the resource.
(Optional)
Name
Set the application related URL position to introduce the resource.
This property is not supported in the new Struts1.1, which is replaced with the PAGE property.
(Optional)
page
Set the application related URL position to introduce the resource.
(Optional)
TRANSACTION
If set to True, in the possible case, the transaction tag will be included in the final URL. The default value is false
(Optional)
Message
The Message tag is used to get the corresponding string properties of the corresponding keyword from a predefined resource. It also has the ability to handle the ability to represent the parameters represented by placeholders. This label is used to support the internationalization of the application.
When there is a problem in the label (such as the application without binding resource files, or the specified keyword is found in the resource file), a request period will throw an exception.
This tag cannot contain label content.
This tag has eleven attributes
Attributes
Description
arg0
Set the parameter value when there is a first parameter in the string
(Optional)
Arg1
Set the parameter value when there is a second parameter in the string
(Optional)
Arg2
Set the parameter value when there is a third parameter in the string
(Optional)
Arg3
Set the parameter value when there is a fourth parameter in the string
(Optional)
Arg4
Set the parameter value when there is a fifth parameter in the string
(Optional)
Bundle
Set the name of the BEAN of the MessageResources object containing the message string, the BEAN's scope is Application, which corresponds to a
(Optional)
Key
The keyword of the message, Struts uses the keyword to find the corresponding message in a predefined resource, which must appear in the resource, otherwise an exception will be thrown. If the property is not set, the keyword will be generated via the Name and Property property.
(Optional)
Locale
The SESSION scope contains the name of the BEAN of the current Locale object, and then this property is used to generate a message related to the user area settings.
The default is action.locale_key
(Optional)
Name
Set the name of the bean used to get the keyword. If the Property property is not set, the value of the bean itself will be used as a keyword.
(Optional)
Property
Set the name for obtaining the properties of the BEAN for the keyword.
(Optional)
Scope
Set the scope of the BEAN for finding the keyword.
If there is no setting, look for bean as follows: Page, Request, Session, Application
(Optional)
Page