본문 바로가기

개발/Java & Spring

[SpringMVC] GET/POST 요청시 파라미터/body 값 한글 깨짐 해결

1. POST 


spring -> src/main/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




2. GET


tomcat config - server.xml

<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"   URIEncoding="UTF-8"/>
 <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"   URIEncoding="UTF-8"/>


뒤에 URIEncoding 부분만 추가