웹 & 프레임워크

스프링에서 간단하게 web.inf 에서 인코딩(Encoding) 처리하자

늘근이 2014. 5. 25. 22:46

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"id="WebApp_ID" version="2.5">

  <display-name>0502_step01_mvc_api</display-name>

 

  <filter>

  <filter-name>myEncodingFilter</filter-name>

  <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>

 

  <init-param>

               <param-name>encoding</param-name> <!-- encoding 정해져있음 -->

               <param-value>utf-8</param-value>

  </init-param>

  </filter>

 

  <filter-mapping>

  <filter-name>myEncodingFilter</filter-name> <!-- 위에  필터이름으로 등록한걸로 -->

  <url-pattern>*.do</url-pattern>

 

  </filter-mapping>