JSP expression language

Source: Internet
Author: User
Tags object definition empty expression function definition functions keyword list string
Js

①el keyword List

div  -except (/)            mod -Take (%)          eq -equals (= =)            ne   -Not equal to (!=)
lt   -less than (<)           gt  -Greater than (>)          le -less than or equal ( <=)       ge   -greater than or equal to (>=)
and  -Logic and (&&)        or  -Logic or (| |)       not-logical non (!)          true -Logic True
false-logical false            null-null value             instanceof-             empty-null test operator


②el built-in objects

----------------------------------------------------
Implied object type description
----------------------------------------------------
PageContext Java.util.Map represents the PageContext object for this JSP
Pagescope Java.util.Map Gets the value of the property name of the page share range
Requestscope Java.util.Map Gets the value of the property name for the request shared scope
Sessionscope Java.util.Map Gets the value of the property name of the session shared range
Applicationscope Java.util.Map Gets the value of the property name of the application shared range
param java.util.Map function with Request.getparameter () method
Paramvalue Java.util.Map function with Request.getparametervalues () method
Header Java.util.Map function with Request.getheader () method
Heradervalues Java.util.Map function with Request.getheaders () method
Cookie Java.util.Map function with Request.getcookies () method
Initparam Java.util.Map function with Application.getinitparameter () method
----------------------------------------------------------


③el operator

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


Custom Functions in ④el

1. Write function definition, function declaration must be static in class
Package elfunction;
public class Functions {
public static string ToUpper (string value) {
return Value.touppercase ();
}
}

2. Write the custom function of the TLD file, placed in the <taglib> tag
<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. Introduction of label definition files 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 custom functions in the form of a custom label on the page
<%@ taglib uri= "/web-inf/tlds/elfunction.tld" prefix= "Elfun"%>
${elfun:toupper ("ABCDEFG")}



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.