Introduction to filters and introduction to solvent Filters

Source: Internet
Author: User

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

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.