THE + JSTL

EL
1.EL (Expression Language)
JSP script code: chaotic structure, mixed with HTML script, error-prone code is easy to maintain.
To solve these problems introduced the EL expression using EL expressions to optimize program code and increase readability.
2.EL effect expression:
1. Obtain data field (key)
2. Execute operation (focus)
3. The common object acquired web (Key)
4. Call java method (Learn)

Example:
obtaining object attributes JavaBean
$ { news.title}
array element, List, the element type of the object Map
$ {list [0]}
using various types of operators processing the raw data simply
$ {totalRecordCount / pageSize}
shielding common abnormalities
$ {username}
to achieve a simple the automatic type conversion
$ {news} corresponds (News) the request.getAttribute ( "News")


3. syntax:
the EL expression (the expression Language)
$} {e.g. the EL expression: $ {username}
the EL operator
operator " . "
Get object properties, such as: $ {news.title}
operator" [] "
Obtaining object attributes, for example: $ {news [ "title" ]}
Gets objects in the collection, for example: $ {newsList [0]}

EL strictly case-sensitive, beginners in strict accordance with specification writing, help develop good coding practice

4.El expression field data acquisition (Visiting Scope)
using the jsp servlet using a small script to get data transmitted from the contents of
  <% = the request.getAttribute ( "RNAME")%>
  <% = pageContext.getAttribute ( "pname")%>
  <% = session.getAttribute ( "sname")%>
  <% = application.getAttribute ( "ANAME")%>
using El Servlet expression accepts data transmitted from the content
  $ {requestScope.rname} is equivalent to $ {rname} // request scope
  $ {pageScope.pname} // page scope
  $ {seesionScope.sname} // session scopes
  $ { applicationScope.aname} // scoping


Content provided by the session request in .getSession () method .setAttribute () method

5.EL four domain object and life cycle
request requesting the whole gamut chain
application range of the entire application domain
session: the entire gamut conversation
pageContext: Domain range is a jsp page

6.EL operator
() to change the execution priority, for example $ {3 * (4 + 5)}
+, -, *, /,%, arithmetic operators such as + 2 $ {3}
==, =,! >,> =, <, <= relational operator, e.g. $ {a == b} EQ A or B} {$
&&, || ,! logical operators && e.g. to false to true} {$
:? conditional operator, e.g. A {$> B. 1:? 2}
empty for detecting whether or not the variable name is null, is equal to nULL, e.g. empty name} {$

empty determines whether there are two effects 1. 2. Analyzing the container is null or not null length 0 whether

the EL operation when making a plurality of objects, to write a whole within the {}
$} √ {param.password1 param.password2 ==
$ == $ {} {param.password1 param.password2} ×
$ {$ param.password1 == $ {} {} param.password2 } ×



JSTL
1.JSTL (Page the Java Standard Tag Library), JSP Standard Tag Library.
The library contains a series of a series of standard labels used in the development of JSP.

Jstl tag library contains a total of four tag library
core: core tag library, focus
fmt: format tag library, two major label
sql: database tag library, obsolete
xml: xml tag library, obsolete

Guess you like

Origin www.cnblogs.com/jiayiblog/p/10987619.html