Difference between JSP implicit object and El expression implicit object

Source: Internet
Author: User

 JSP implicit objects (9 ):

1. Request 2. Response 3. config 4. Application 5. Exception 6. Session 7. Page 8. Out 9. pagecontext

 

El (Expression Language) Implicit object (11 ):

Pagecontext

Corresponding to the pagecontext object on the JSP page (Note: The pagecontext object is used .) Pagination Map object used to save attributes in the page domain Requestscope Map object used to save attributes in the request domain Sessionscope Map object used to save attributes in the session domain Applicationscope Map object used to save attributes in the application domain

 

Param Indicates a map object that saves all request parameters. Paramvalues Indicates a map object that saves all request parameters. For a request parameter, a string [] is returned. Header Indicates a map object that stores all HTTP request header fields. Headervalues Returns the string [] array. Note: If the header contains "-", for example, accept-encoding, headervalues ["Accept-encoding"] Cookie Indicates a map object that saves all cookies. Initparam Indicates a map object that saves all web application initialization parameters.

 

There is only one El implicit object in the JSP implicit object class: This is the pagecontext implicit object. The JSP implicit object with the same name is actually the same object, and the remaining El implicit objects are Java ing (MAP ), they only provide an easier way to access certain properties of the pagecontext implicit object.
Two parameters are used to access the implicit object: the parameters used to access the HTTP request (Form submission parameters), namely, Param and paramvalues. param is a ing used to access Single-value parameters. paramvalues can be used to access parameters that may contain multiple values. The following experiment will show how this will be done.
There are three header access implicit objects that can be used to access the HTTP header: Header, headervalues, and cookie. These mappings are useful if you want to access the HTTP header or cookie in the original way.
There are four scope implicit objects: pagination, requestscope, sessionscope, and applicationscope. These implicit objects are ing and they can easily access the scope attributes. For example, the username attribute appended to the request scope can be directly accessed through the El expression $ {requestscope. Username.
There is also an implicit object for accessing the initialization parameter: initparm. This ing can be used to access the values of initialization parameters. The values of initialization parameters are generally set in Web. xml.

Features of El (Expression Language) Implicit objects:

1. El can only obtain attributes of an object, but cannot be rewritten or directly called.

2. Strings in El can be double cited or single quotes, similar to HTML

3. When El outputs null, it replaces the image with an empty string (""): (empty)

4. The El expression converts the string to a value (null = 0) During computation)

5. El cannot access local variables and can only access attributes in the scope.

6. The empty operator in El treats "" as null $ (empty null) & $ (empty "") as true

7. Compare string content in El using =

$ {"2" + "4"} automatically converts characters to numbers

Never confuse JSP hermit objects with El Expression Language implicit objects

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.