| < Day Day Up > |
|
The <logic:match /> tag evaluates its body if the variable specified by any one of the attributes cookie, header, name, parameter, or property attributes contains the specified constant value. The <logic:match /> tag has a body type of JSP and supports eight attributes, described in Table 18.11.
Attribute | Description |
---|---|
value | Identifies the constant value to which the scripting variable will be compared. (Required) |
location | Specifies where the match should occur in the named variable. The possible values are start and end. If the location attribute is not specified, then the value can occur anywhere in the variable. (Optional) |
cookie | Specifies an HTTP cookie to be used as the variable being compared to the value attribute. (Optional) |
header | Specifies an HTTP header to be used as the variable being compared to the value attribute. (Optional) |
name | Specifies a scripting variable to be used as the variable being compared to the value attribute. (Required) |
property | Specifies the data member of the scripting variable to be tested. (Optional) |
parameter | Specifies an HTTP parameter to be used as the variable being compared to the value attribute. (Optional) |
scope | Defines the scope of the bean specified by the name attribute. If the scope attribute is not specified, then the tag will search for the bean in the scopes, in the order of page, request, session, and application. (Optional) |
An example of using the <logic:match /> tag is shown here:
<logic:match name="sentence" value="Bob"> The string Bob occurs in the sentence. </logic:match>
In this example, we test the scripting variable sentence. If it contains the text Bob, then the tag's body will be evaluated.
| < Day Day Up > |
|