1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
 
<filter>
        <filter-name>characterEncodingFilter</filter-name>
        <filter-class>com.newlecture.web.filter.CharacterEncodingFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>characterEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping> 
 
서블릿 어노테이션을 이용하는 방법 2가지가 있다.
 
@WebFilter("/*")
public class CharacterEncodingFilter implements Filter {
 
    @Override
    public void doFilter(ServletRequest request,
            ServletResponse response,
            FilterChain chain)
            throws IOException, ServletException {
 
        request.setCharacterEncoding("UTF-8");
        
        chain.doFilter(request, response);
    }
 
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs

 

 

출처 : https://www.youtube.com/watch?v=d8GkAMpjDfs&list=PLq8wAnVUcTFVOtENMsujSgtv2TOsMy8zd&index=20

+ Recent posts