/*

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











+ Recent posts