What are JSP expression languages?

Source: Internet
Author: User

① EL keyword list

Div-division (/) mod-remainder (%) eq-equal to (=) ne-not equal (! =)
Lt-less than (<) gt-greater than (>) le-less than or equal to (<=) ge-greater than or equal to (> =)
And-logical and (&) or-logical or (|) not-logical non (!) True-logical truth
False-logical false null-null instanceof-empty-null test operator


② EL built-in object

----------------------------------------------------
Implicit object type description
----------------------------------------------------
PageContext java. util. Map indicates the PageContext object of the JSP.
Pagination java. util. Map obtains the value corresponding to the attribute name of the Page sharing range.
RequestScope java. util. Map gets the value corresponding to the attribute name of the Request sharing range.
SessionScope java. util. Map gets the value corresponding to the attribute name of the session sharing range.
ApplicationScope java. util. Map gets the value corresponding to the attribute name of the application sharing range.
The param java. util. Map function is the same as the request. getParameter () method.
ParamValue java. util. Map function is the same as request. getParameterValues () method
The header java. util. Map function is the same as the request. getHeader () method.
The heraderValues java. util. Map function is the same as the request. getHeaders () method.
Cookie java. util. Map function is the same as request. getCookies () method
The initParam java. util. Map function is the same as the application. getInitParameter () method.
----------------------------------------------------------


③ EL Operator

[].
()
-! Empty
*/%
+-
<> <=> =
=! =
&&
|
$ {? B: C}


④ User-defined functions in EL

1. Write a function definition. The function declaration must be static in the class.
Package elfunction;
Public class functions {
Public static String toUpper (String value ){
Return value. toUpperCase ();
}
}

2. Write the TLD file of the custom function and place it in the <taglib> label.
<Function>
<Name> toUpper </name>
<Function-class> elfunction. functions </function-class>
<Function-signature>
Java. lang. String toUpper (java. lang. String)
</Function-signature>
<Description> A to Upper function. </description>
</Function>

3. Introduce the tag definition file in web. xml.
<Taglib>
<Taglib-uri>/WEB-INF/tlds/elfunction. tld </taglib-uri>
<Taglib-location>/WEB-INF/tlds/elfunction. tld </taglib-location>
</Taglib>

4. Introduce udfs in the form of custom tags on the page
<% @ Taglib uri = "/WEB-INF/tlds/elfunction. tld" prefix = "ELFun" %>
$ {ELFun: toUpper ("abcdefg ")}

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.