JSTL-EL expressions http://ericxu131.javaeye.com/blog/173666
An El expression contains variables and operators. Any bean stored in a JSP scope (such as page, request, session, and application) can be used as an El variable. In addition, El supports the following predefined variables:
Variable name |
Description |
Pagination |
A set of variables containing the scope of all pages (a java. util. map) |
Requestscope |
A set of variables that contain the scope of all request scopes (a java. util. map) |
Sessionscope |
A set of variables containing the scope of all sessions (a java. util. map) |
Applicationscope |
A set of variables that contain the range of all application scopes (a java. util. map) |
Param |
A set containing all request parameters (a java. util. MAP), which is assigned a value based on a string value. |
Paramvalues |
A set of all request parameters (a java. util. Map). Each parameter is assigned a value corresponding to a string array. |
Header |
A set of headers containing all requests (a java. util. Map). Each header information is assigned a value based on a string value. |
Headervalues |
A set of header information containing all requests (a java. util. Map). Each header information value is saved in a string array and assigned a value. |
Cookie |
A set of cookies (a java. util. Map) that contain all requests. Each cookie (javax. servlet. http. Cookie) corresponds to a cookie value. |
Initparam |
A set of initialization parameters of all applications (a java. util. Map). Each parameter is assigned a value based on a string value. |
Pagecontext |
An instance of the javax. servlet. jsp. pagecontext class is used to provide access to different request data. |
The operator describes the operations you want to perform on variables. If you have used any programming language before, the operators used in El expressions may seem familiar to you. Because they are the same as the operators supported in most languages.
Operator |
Description |
. |
Access a bean attribute or map entry |
[] |
Access an array or linked list element |
() |
Grouping of child expressions to change the assignment order |
? : |
Conditional statements, such:Condition?Iftrue:Iffalse. If the condition is true, the expression value is the former, and vice versa. |
+ |
Mathematical operators, plus operations |
- |
Mathematical operator, subtraction or inverse of a value |
* |
Mathematical operators and multiplication operations |
/Or Div |
Mathematical operators, except operations |
% Or mod |
Mathematical operators, modulo operations (remainder) |
= Or EQ |
Logical operator to determine whether the two sides of the symbol are equal. If the two sides are equal, true is returned. Otherwise, false is returned. |
! = Or ne |
Logical operator to determine whether the two sides of the symbol are not equal. If not equal, true is returned; otherwise, false is returned. |
<Or lt |
Logical operator to determine whether the left side of the symbol is less than the right side. If the value is less than true, false is returned. |
> Or GT |
Logical operator to determine whether the left side of the symbol is greater than the right side. If the value is greater than the right side, true is returned. Otherwise, false is returned. |
<= Or Le |
Logical operator to determine whether the left side of the symbol is less than or equal to the right side. If the value is less than or equal to true, false is returned. |
> = Or Ge |
Logical operator to determine whether the left side of the symbol is greater than or equal to the right side. If the value is greater than or equal to true, false is returned. |
& Or and |
Logical operators and operations. If both the left and right sides are true, true is returned. Otherwise, false is returned. |
| Or |
Logical operators, or operations. True is returned if either side of the left or right is true. Otherwise, false is returned. |
! Or not |
Logical operators, not operators. If the return value is true, the return value is false. Otherwise, the return value is true. |
Empty |
It is used to judge an empty variable value: NULL, an empty string, an empty array, an empty map, and a collection with no entries |
Func(ARGs) |
Call method,FuncYesmethod name,ARGsYes. It can be none, or one or more parameters are separated by commas. |
An El expression can contain numbers, text (between single quotes or double quotes), Boolean values, and null values.
Because an El expression can appear in a static text, you must tell the JSP Container that it should be processed as an El expression. You can do this by using delimiters. An El expression is always marked with "$ {}" (a "$" symbol, a left curly braces, and a right curly braces ).
In addition to the length () method used in this method, the jstl1.1 tag Library also contains many other frequently used functions:
Function |
Description |
FN: Contains (string, substring) |
Returns true if the string parameter contains the substring parameter. |
FN: containsignorecase (string, substring) |
Returns true if the string parameter contains the substring (Case Insensitive ). |
FN: endswith (string, suffix) |
Returns true if string ends with suffix. |
FN: escapexml (string) |
Convert the XML (HTML) with special meaning to the corresponding XML character entity code, and return |
FN: indexof (string, substring) |
Returns the position where the substring parameter appears for the first time in the string parameter. |
FN: Join (array, separator) |
Concatenates a given array with a given delimiter separator to form a new string and return it. |
FN: length (item) |
Returns the number of elements contained in the parameter item. The parameter item type is array, collection, or string. For the string type, the return value is the number of characters in the string. |
FN: Replace (string, before, after) |
Returns a String object. Replace all places where the before parameter appears in the parameter string with the parameter after string, and return the replaced result. |
FN: Split (string, separator) |
Returns an array that uses the separator parameter as the delimiter to split the string parameter. Each part of the split is an element of the array. |
FN: startswith (string, prefix) |
Returns true if the string parameter starts with the prefix. |
FN: substring (string, begin, end) |
Returns the string part of the parameter, starting from the begin parameter to the end position of the parameter, including the character of the end position. |
FN: substringafter (string, substring) |
Returns the part of the substring that follows the string parameter. |
FN: substringbefore (string, substring) |
Returns the part of the substring before the string parameter. |
FN: tolowercase (string) |
Convert all characters of the string parameter to lowercase and return |
FN: touppercase (string) |
Converts all characters of the string parameter to uppercase and returns |
FN: trim (string) |
Remove the spaces at the beginning and end of the string parameter and return it. |