El and Jstl Learning (i) El Technology

Source: Internet
Author: User

1. EL Expressions Overview

El (express lanuage) expression can be embedded inside the JSP page, reduce the writing of JSP script, El appears to replace the JSP page script writing.

2. El extracts data from the domain (El's most important role)

JSP script: <%=request.getattribute (name)%>

El expression replaces the above script: ${requestscope.name}

El's main function is to obtain data in four fields, format ${el expression}

El gets the value in the PageContext domain: ${pagescope.key};

El obtains the value in the request domain: ${requestscope.key};

El gets the value in the session field: ${sessionscope.key};

El gets the value in the application domain: ${applicationscope.key};

El obtains a value from four domains ${key};

---also gets the properties from the PageContext domain, the request domain, the session field, the application domain, and gets it in a domain, not looking backwards.

3. El's Built-in objects 11 X

Pagescope,requestscope,sessionscope,applicationscope

----Get data from a domain in a JSP

param,paramvalues--receive parameters.

Equivalent to Request.getparameter () request.getparametervalues ()

header,headervalues--Getting request header information

Equivalent to Request.getheader (name)

initparam--getting global initialization parameters

Equivalent to This.getservletcontext (). Getinitparameter (name)

Cookie--web Cookies in development

Equivalent to Request.getcookies ()---cookie.getname ()---cookie.getvalue ()

Pagecontext--web in the development of PageContext.

PageContext get the other eight big objects

${pagecontext.request.contextpath}

equivalent <%=pagecontext.getrequest () .getcontextpath%> This code cannot be implemented get the name of your web App

4. El execution expression

For example:

${1+1}

${empty User}--empty Determines if an object is NULL, is NULL returns True

${user==null?true:false}

El and Jstl Learning (i) El Technology

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.