EL expression,

Source: Internet
Author: User

EL expression,

1. The basic form of EL expression is: if EL expression is used in the jsp template file, the expression value is directly output to the webpage. Example: Java expression: <% = request. getParameter ("usernamae") %> -- >$ {param. username} (form)
2. directly access the attributes of the object: e.g. $ {request. user. username }<=>$ {request. user ['username']}
3. el operator: Arithmetic Operator: +-*/(not entire division) % relational OPERATOR: ==<>... logical operator! | & Empty operator true: If var is null, TRUE condition operator a? is returned? B: c
Built-in object
1. The EL language defines 11 implicit objects, all of which are java. util. Map types. web page creators can easily access specific data of web applications through them. The implicit object name indicates that the attribute names and attribute values within the application scope of applicationweb are mapped to the cookie name and Cookie object in the Cookie client request to map the project names and project values in the header of the header request. For example: $ {header. host} is equivalent to <% = request. getHeader ("host") %> headerValues maps the project names in the Http request header to all worthy arrays that match your project, for example, [Ljava. lang. string; @ 20f38b9a is equivalent to <% request. getHeaders ("accept-language ") %> initParam ing the initialization parameter names and parameter values of web applications pagination ing the property names and attribute values in the page range param ing the parameter names and parameter values of customer requests to paramValues request parameter names maps the attribute names returned by the requestScope request in the parameter array to the attribute names in the sessionScope return range.
2. classification: (1) specific data within the request range: header, headerValues, param, paramValues, cookie $ {header ["user-agent"]} (access using [] is required, because it does not comply with the variable naming rules) <==>< % = requesst. getHeader ("user-agent") % >$ {cookie. username. value }<=> call the relationship between the getValue () method of the Cookie object named username and the front-end cookie (2) attribute values in a specific range: pagination, requestScope, sessionScope, and applicationScope attributes
(3) pageContext, indicating the PageContext object $ {pageContext. request \. contentPath }$ {pageContext. servletContext. serverInfo }<=><%= application. getServerInfo % >$ {pageContext. request. requestURL }<=><%= request. getRequestURL () % >$ {pageContext. response. characterEncoding }<=><%= response. getCharacterEncoding () %> (4) indicates the set of initialization parameters for the web application, initParam <=><%= appliction. getInitParameter ("driver") %> category: (1) specific data within the request range: header, headerValues, param, paramValues, cookieMozilla/5.0 (X11; Ubuntu; Linux x86_64; rv: 54.0) Gecko/20100101 Firefox/54.0 (must be accessed using [] because it does not comply with the variable naming rules) <==><%= requesst. getHeader ("user-agent") %> <=> call the relationship between the getValue () method of the Cookie object named username and the front-end cookie (2) attribute values in a specific range: pagination, requestScope, sessionScope, and applicationScope attributes
 
 



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.