1.
2.
3.
4.
5.
Filter application
1. Using filters to solve the whole station garbled problem
1.1 Garbled categories
Garbled into get and post way request garbled
1.2 Post request garbled solution
Post request garbled good solution just one line of code to fix request.setcharacterencoding ("Utf-8") tells the server to use Utf-8 to get the parameters
1.3 Get Request garbled solution
Problem: Cannot solve the garbled problem for a parameter, because the filter is general-purpose, the other request may not have this parameter, so think of the transformation to get the request parameters of the three methods, and the way of direct inheritance there are many ways to achieve their own, So inherit Httpservletrequestwrapper (an adorner class, all calls the method of the decorated object itself), and then transform the three methods to get the parameters
1.3.1 Implementation Getparametermap ()
1.4 Supplement
1.4..1 How to implement a filter the first step is to implement the filter interface (Chain.dofilter method release); The second step is to register in Web. XML, including the filter node and the mapping node
1.4.2 Gets the request parameter method has several getparameter,getparametermap,getparametervalues (PS: If these three methods garbled problem solves, then obtains the request garbled problem also solves)
1.4.3 How to transform a method in a class there are several ways to inherit, adorners, dynamic proxies
Wisdom Podcast Javaweb day14--Listener (User kick), filter (solve the whole station garbled)