| < Day Day Up > |
|
The <logic:notPresent /> tag evaluates its body if the variable specified by any one of the cookie, header, name, parameter, or property attributes is not present in the applicable scope. The <logic:notPresent /> tag has a body type of JSP and supports eight attributes, described in Table 18.14.
Attribute | Description |
---|---|
cookie | Specifies an HTTP cookie to be used as the variable being tested for existence. (Optional) |
header | Specifies a case-insensitive HTTP header to be used as the variable being tested for existence. (Optional) |
name | Defines a scripting variable to be used as the variable being tested for existence. (Optional) |
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 tested for existence. (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) |
role | Used to determine if the currently authenticated user belongs to one or more named roles. If more than one role is listed, then they must be separated by commas. (Optional) |
user | Used to determine if the currently authenticated user has the specified name. (Optional) |
An example of using the <logic:notPresent /> tag is shown here:
<logic:notPresent name="username" scope="session"> There is no username attribute in the session. </logic:notPresent >
In this example, we test for the existence of the session attribute username. If the username parameter is not found in the HttpSession, then the tag's body will be evaluated.
| < Day Day Up > |
|