/*
* OS: Windows 10
* STS Version: sts-3.9.5.RELEASE
* Project: Spring MVC
* Title: web.xml 한글 처리
*/
org.springframework.web.filter.CharacterEncodingFilter
: Servlet Filter that allows one to specify a character encoding for requests. This is useful because current browsers typically do not set a character encoding even if specified in the HTML page or form.
This filter can either apply its encoding if the request does not already specify an encoding, or enforce this filter's encoding in any case ("forceEncoding"="true"). In the latter case, the encoding will also be applied as default response encoding (although this will usually be overridden by a full content type set in the view).
-- 출처
https://docs.spring.io/spring/docs/5.0.4.BUILD-SNAPSHOT/javadoc-api/org/springframework/web/filter/CharacterEncodingFilter.html
src/main/webapp/WEB-INF/web.xml
파일의 아래쪽에 추가 해주면 됨.
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
728x90
'Framework > Spring' 카테고리의 다른 글
[Spring MVC] Eclipse 에서 Import 하기 (0) | 2018.09.03 |
---|---|
[Spring MVC] Eclipse 안에서 jsp 파일에 한글 설정 (0) | 2018.09.02 |
[Spring] Error: context:annotation-config, context 네임스페이스 사용하기 (0) | 2018.09.01 |
[Spring] main 함수에서 getBean 사용 (0) | 2018.08.31 |
[Spring] xml 파일(Spring Bean Configuration File) 생성 (0) | 2018.08.31 |