Grammatical structure
${expression}
EL provides. And [] Two operators to access data.
. Only the given value cannot be retrieved dynamically worth the name of the property to be accessed contains some special characters, such as. or? For symbols that are not letters or numbers, be sure to use [].
${sessionscope.user[data]} in data is a variable
------------------------------
${username}. It means to take out a range of names called
The username variable. Search sequentially from page, Request, Session, application range, no return null
Name of the attribute range in El
Page Pagescope
Request Requestscope
Session Sessionscope
Application Applicationscope
The El language can display a logical expression such as ${true and false} and the result is a false relationship expression such as ${5>6} result is false arithmetic expression such as ${5+5} result is 10
Condition tags >
1. There are five arithmetic operators: + 、-、 * or $,/or div,% or mod
2. There are six relational operators: = = or EQ,! = or NE, < or LT, > or GT, <= or LE, >=, or GE
3. The logical operator has three:&& or an and, | | Or,!, or not
4. There are three other operators: the empty operator, the condition operator, the () operator
Example: ${empty param.name}, ${a? B:C}, ${a* (B+c)}
Iteration label (syntax structure)
Syntax: <c:foreach items= "collection" var= "name" varstatus= "status" begin= "int"
end= "int" step= "int" >
Loop body
</c:forEach>
Description: 1) Items: is a collection, with an El expression;
2) Var: variable name, storing items
3) Varstatus: variable showing the loop state
①index: starting from 0; Index of the Loop
②count: Element position, starting from 1;
③first: Displays True if it is the first element;
④last: Displays True if it is the last element;
4) Begin: The initial value of the loop (integral type);
5) End: Loop end;
6) Step: Step length, the value of the cycle interval;
<fmt:> Formatting tags
Description: Need to import <%@ taglib prefix= "FMT" http://java.sun.com/jsp/jstl/fmt ">http://java.sun.com/jsp/jstl/fmt"%>
1) Format date <fmt:formatdate value= "" pattern= "Yyyy-mm-dd HH:mm:ss"/>
Value: The date value taken by an El expression or <%new date ()%>;
Pattern: The date format of the output;
2) format digital <fmt:formatnumber value= "${n}" pattern= "###,###.##"/>
To intercept displayed characters
1. Introducing Library information <%@ taglib url= "http://java.sun.com/jsp/jstl/functions" prefix= "FN"%>
2, use intercept method value= "${fn:substring (stu.birthday,0,10)}" to fetch the value and intercept
Date formatting:
1. Introducing Library information <%@ taglib url= "http://java.sun.com/jsp/jstl/fmt" prefix= "FMT"%>
2. <fmt:formatdate pattern= "Mm-yy-dd" var= "Fmtdate" value= "${x.birthday}" >---Formatting
3. ${fmtdate} references
Java Knowledge Summary-11