728x90
반응형
#스프링 한글 처리 하는 방법(web.xml)
#한글 처리 주석 참조(EUC-KR 대신 UTF-8등 원하는 방식으로 변환 가능)
-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee https://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- The definition of the Root Spring Container shared by all Servlets
and Filters -->
<!-- 어플리케이션 범위 초기화 파라미터 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<!-- 서블릿 범위 초기화 파라미터 -->
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<!-- 한글 처리 -->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>EUC-KR</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>
</web-app>
728x90
반응형
'IT > Spring' 카테고리의 다른 글
[Spring] - 스프링 Bean 등록(Annotation, XML) 하는 방법 (0) | 2020.08.13 |
---|---|
[Spring] - 스프링 @RequestMapping 어노테이션 사용 방법 (0) | 2020.08.13 |
[Spring] - 스프링 Maven Repository에서 mysql 라이브러리 적용 하는 법 (0) | 2020.08.13 |
[Spring] - 스프링 개념 정리(DI, IOC, AOP) (0) | 2020.08.13 |
[Spring] - 스프링(Spring Tool Suite) STS 다운로드 및 설치 방법 (0) | 2020.08.11 |
댓글