review
EL
- Syntax ${expression}
- EL domain objects, and lookup rules
- pageScope
- requestScope
- sessionScope
- applicationScope
- What is the function of pageContext object in EL
- You can get other objects
- ${ pageContext.request.contextPath }
- How does EL display the attributes of students, elements in list and elements in map
- ${Student object. Property name}
- ${list [index]}
- ${map.key} or ${map["key"]}
- name-abc
- 1
- empty operator in EL
- Judge whether the variable is null
- String ''
- The collection has no elements
JSTL
-
<%@ taglib uri=".../jsp/jstl/core" prefix="c" %>
-
Conditional judgment label
<c:if test="${condition}"></c:if>
-
Circular label
<c:forEach items="${ Collection or array }" var="Temporary variable name corresponding to each element"> ${Temporary variable name} </c:forEach>
mvc concept
- Model model (data), such as student
- View view (display data), such as jsp
- controller controllers (linking models and views) such as servlet s
- How do they combine
filter
-
Define and configure filters
@WebFilter("/Filtered resource path") public class Filter class implements Filter { public void doFilter(request, response, FilterChain chain) { // Release chain.doFilter(request, response); } }
-
How to release requests and how to intercept requests
-
Interception order of multiple filters
- Sort by the class name of the filter, and filter from small to large (annotation method)
Today's content
1. Filter xml configuration (*)
<filter> <filter-name>name</filter-name> <filter-class>Full path of class</filter-class> <init-param> <param-name>Initialization parameter name</param-name> <param-value>Initialization parameter value</param-value> </init-param> </filter> <filter-mapping> <filter-name>name</filter-name> <url-pattern>/Filter resource paths</url-pattern> </filter-mapping>
-
The order of filter execution in xml mode is the order of filter mapping (*)
-
FilterConfig.getInitParameter("initialization parameter name") returns the initialization parameter value
2. Filter interception position (understand)
- request
- forward
- include
- error
- async
<error-page> <exception-type>Exception type</exception-type> <location>/Error page</location> </error-page> <error-page> <error-code>Error status code (404),500)</error-code> <location>/Error page</location> </error-page>
3. Classification of listeners (understand)
Events (application start, application stop, request object creation, session object creation, and session object destruction)
-
ServletContextListener(*)
@WebListener public class Listener class implements ServletContextListener{ public void contextInitialized(ServletContextEvent event) { // event gets the ServletContext object just created event.getServletContext(); } public void contextDestroyed(ServletContextEvent event) { // event gets the ServletContext object to be destroyed } }
Together, the three components of the web (servlet, filter and listener) can also configure listeners in xml:
<listener> <listener-class>Listener class full path</listener-class> </listener>
-
HttpSessionListener
-
ServletRequestListener
-
ServletContextAttributeListener
-
HttpSessionAttributeListener
-
ServletRequestAttributeListener
- When setAttribute and removeAttribute are called, the corresponding events of the above listeners will be triggered
-
HttpSessionBindingListener
// Student stu = new Student() // session.setAttribute("student", stu); // session.removeAttribute("student"); public class Student implements HttpSessionBindingListener { @Override public void valueBound(HttpSessionBindingEvent event) { // Execute when this object is put into the session domain } @Override public void valueUnbound(HttpSessionBindingEvent event) { // Execute when this object is removed from the session domain } }
[the external chain picture transfer fails, and the source station may have an anti-theft chain mechanism. It is recommended to save the picture and upload it directly (img-IxaBoZmz-1597661201142)(imgs/image-20200817113039273.png)]
If an object like Student is to be stored in a session, it must implement the Serializable interface, otherwise it cannot be used with the passivation and activation functions (understand)
mysql
sql structured query language
- oracle
- mysql
- sql server
1. Introduction and installation
mysql client software
- sqlyog
- navicat
Database database
table
Row record line
Column column
Data data
dba database administrator
2. SQL statement
ddl - create, modify and delete library tables
create database [if not exists] Library name [character set character set]; alter database Library name character set New character set drop database [if exists] Library name; show databases; -- View all library tables show create database Library name; -- View a database creation statement use Library name;
View the character set of the table
show create table user \G
Table data type (*)
Int - a 4-byte integer
Tinyint - 1 byte
Smallint - 2 bytes - short
bigint - 8 bytes - long
Varchar (maximum length) - string. For example, varchar(10) means that it can store up to 10 characters
The datetime range is large
timestamp is not recommended. The scope is small
a key
create table Table name ( Column 1 type [constraint], Column 2 type [constraint], ... column n type [constraint] ) [character set character set];
Understand (all can be completed through the graphical interface)
alter table Table name rename to New table name; -- Modify table name alter table Table name add New column name type [constraint]; -- Add column alter table Table name modify New type of column name [New constraint]; -- Modify column alter table Table name drop Listing; -- Delete column alter table Table name change Old column name new column name new type [New constraint]; -- Modify column desc Table name; -- See which columns are in the table drop table [if exists] Table name; show tables; -- See which tables are available show create table Table name; -- View table creation statements (including character sets)
dml - add, delete and modify data (*)
dql - query data (*)
dcl - rights management
3. Constraints
Divide column name new type [new constraint]; – Mo dify column
alter table name drop column name; – Delete column
alter table name change old column name new column name new type [new constraint]; – Modify column
desc table name; – See which columns are in the table
drop table [if exists] table name;
show tables; – See which tables are available
show create table name; – View table creation statements (including character sets)
#### dml - add, delete and modify data (*) #### dql - query data (*) #### dcl - rights management ### 3. Constraints