Java Knowledge Summary-11

Source: Internet
Author: User

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

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.