Spring @RequestBody 한글 깨짐현상 해결하기

Programming/Spring 2017. 3. 20. 15:27 Posted by 생각하는로뎅
반응형

1. STS 기준으로 설명


2. webapp/web.xml

</servlet-mapping>


<!-- 한글 utf-8 -->

<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>



</web-app>



3. webapp/WEB-INF/spring/appServlet/servlet-context.xml


<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">

<beans:property name="prefix" value="/WEB-INF/views/" />

<beans:property name="suffix" value=".jsp" />

<beans:property name="contentType" value="text/html; charset=UTF-8"/> <!-- 한글 utf-8 -->

</beans:bean>



4. 테스트 해본다.

반응형