2018. 5. 11. 11:21ㆍ99. 정리전 - IT/11. Java
이하의 방법 중 맞는 것 선택하여 적용해볼 것
01 .server.xml
<Connector port="8080" ... URIEncoding="UTF-8" />
<Connector port="8009" ... URIEncoding="UTF-8" />
02. web.xml
<filter>
<filter-name>Set Character Encoding</filter-name>
<filter-class>filters.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Set Character Encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
03. 소스파일 utf-8형식 으로 저장
프로젝트 상단에서 오른클릭 후 Properties -> Resource -> Text file encoding (UTF-8)
04. 소스코드
<%@pagepageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<% request.setCharacterEncoding("utf-8"); %>
05. 톰켓실행옵션
-Dfile.encoding=UTF-8
View창 중에 Servers -> 해당톰켓서버 -> 더블클릭 ->Open launch configuration -> Common탭 -> Encoding -> UTF-8