Generally, all custom and standard action attributes and their values either remain uninterpreted by, or have well-defined action-type specific semantics known to, a conforming JSP container. However, there are two exceptions to this general rule: some attribute values represent request-time attribute values and are processed by a conforming JSP container, and the id and scope attributes have special interpretations. JSP.2.12.1 Request-Time Attribute ValuesAction elements (both standard and custom) can define named attributes and associated values. Typically a JSP page treats these values as fixed and immutable, but the JSP 1.1 provides a mechanism to describe a value that is computed at request time. An attribute value of the form " <%= scriptlet_expr %> " or ' <%= scriptlet_expr % >' denotes a request-time attribute value . The value denoted is that of the scriptlet expression involved. Request-time attribute values can be used only in actions. If there is more than one such attribute in a tag, the expressions are evaluated left to right. Only attribute values can be denoted in this way (e.g., the name of the attribute is always an explicit name ), and the expression must appear by itself (e.g., multiple expressions and mixing of expressions and string constants are not permitted; instead perform these operations within the expression). The resulting value of the expression depends upon the expected type of the attribute's value. The type of an action element indicates the valid Java programming language type for each attribute value; the default is java.lang.String . By default, all attributes have page translation-time semantics. Attempting to specify a scriptlet expression as a value for an attribute that has page translation time semantics is illegal and will result in a fatal translation error. The type of an action element indicates whether a given attribute will accept request-time attribute values. Most attributes in the actions defined in the JSP 1.1 specification have page translation-time semantics. The following attributes accept request-time attribute expressions:
JSP.2.12.2 The id AttributeThe id="name" attribute/value tuple in an element has special meaning to a JSP container, both at page translation time and at client request processing time; in particular:
Chapter JSP.4 provides details for the case where the language attribute is "java." For example, the <jsp: usebean id=" name " class=" className " .../> action defined later herein uses this mechanism in order to possibly instantiate and subsequently expose the named JavaBeans component to a page at client request processing time. For example: <% { // introduce a new block %> ... <jsp:useBean id="customer" class="com.myco.Customer" /> <% /* * the tag above creates or obtains the Customer Bean * reference, associates it with the name "customer" in the * PageContext, and declares a Java programming language * variable of the * same name initialized to the object reference in this * block's scope. */ %> ... <%= customer.getName(); %> ... <% } // close the block %> <% // the variable customer is out of scope now but // the object is still valid (and accessible via pageContext) %> JSP.2.12.3 The scope AttributeThe scope="pagerequestsessionapplication" attribute/value tuple is associated with and modifies the behavior of the id attribute described above (it has both translation time and client request processing time semantics). In particular, it describes the namespace, the implicit life cycle of the object reference associated with the name , and the APIs used to access this association, as in Table JSP.2-6. Table JSP.2-6. Value of the scope Attribute
|