logic:equal

 < Day Day Up > 



<logic:equal />

The <logic:equal /> tag evaluates its body if the variable specified by any one of the attributes cookie, header, name, parameter, or property equals the constant value specified by the value attribute. The <logic:equal /> tag has a body type of JSP and supports seven attributes, described in Table 18.3.

Table 18.3: <logic:equal /> Tag Attributes

Attribute

Description

value

Identifies the constant value to which the scripting variable will be compared. (Required)

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:equal /> tag is shown here:

 <logic:equal name="user"   property="age"   value="<%= requiredAge %>">   You are exactly the right age. </logic:equal> 

In this example, we test the age data member of the scripting variable user. If this data member equals the value stored in the requiredAge scripting variable, then the tag's body will be evaluated.



 < Day Day Up > 



Professional Jakarta Struts
Professional Jakarta Struts (Programmer to Programmer)
ISBN: 0764544373
EAN: 2147483647
Year: 2003
Pages: 183

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net