Back-End/Spring Framework

[spring]스프링 한글 깨짐 방지

Composer 2018. 8. 31. 14:17


1. 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>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>


2. tomcat server.xml 확인 


<Connector port="8080" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8443"

               URIEncoding="UTF-8" // < *이 부분 확인

               />


'1번', '2번' 원하는 설정을 선택해서 설정 해주면 된다.