The main role of the filter
- 1. Any system or website must determine whether the user is logged in.
- 2 , the network chat system or forum, the function is to filter the illegal text.
- 3. Unified solution coding
How to create a filter:
- 1. Generate a common class and implement the Filter interface (javax.servlet.Filter;) .
- 2. Rewrite the three methods in the interface: init , doFilter , destroy .
- 3 , and then configure the filter in web.xml .