Introduction to filters and introduction to solvent Filters
This is the first time after listening to strong brother, I will immediately write down the points that can be remembered to deepen my memory. Then, I will continue to add the following original documents after viewing the documents.
The filter is processed after the page is sent to the server and filtered by the server.
- Multiple filters can be processed together to form a filter chain.
- You can set multiple processing methods (request, forword, include). If the forward parameter is set on the page, the request cannot be processed.
- You can set the file to be filtered to be a file of a certain type, or a file in a folder or a type of file in a folder.
The following is a supplement:
1. You can set which pages or Servlets use filters.
1. All resources in the application /*
2. File resources of the specified type *. html
3. All files in the specified directory/folder_name /*
4. The specified servlet myfilter. LoggerServlet
6./simplefilter.html
7. specify a single file of the specified type in the directory/dir_name/index. jsp
Note whether the slash "/" exists.
2. You can set the request method to use the filter. The request methods include (request, forward, include, exception)
Request
Href = "a. jsp"
Response. sendRedirect ("a. jsp ");
Window. open ("a. jsp ");
Location. href = "a. jsp ";
Src = "a. jsp"
.........
Forward page Jump
<Jsp: forward ....
SendForward...
Include
There are two methods to include other pages. One is the command label <% @ include file = "xxx. jsp "%>, one is the action tag <jsp: include page =" xxx. jsp "/>
Execetion
......
Iii. Cases
1. Set the encoding to prevent garbled characters
2. access permission Control
Iv. application scenarios
Character encoding conversion, permission management, access logging, and sensitive word Filtering