2021. 1. 9. 16:12ㆍJava/Tomcat
4가지 방법이 있는걸 확인했는데, 나는 3번째를 수행할 때 해결됨
1. ./conf/server.xml 수정
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" URIEncoding="UTF-8" redirectPort="8443" />
<Connector protocol="AJP/1.3"
address="0.0.0.0"
URIEncoding="UTF-8"
port="8009" secretRequired="false"
redirectPort="8443" />
2. ./conf/web.xml 수정
<filter> <filter-name>setCharacterEncodingFilter</filter-name> <filter-class>org.apache.catalina.filters.SetCharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <async-supported>true</async-supported> </filter>
<filter-mapping> <filter-name>setCharacterEncodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
3. 소스 수정
<%@page contentType="text/html; charset=utf-8" %>
<% request.setCharacterEncoding("utf-8"); %>
4. 톰켓 실행 java option 수정
-Dfile.encoding=UTF-8
'Java > Tomcat' 카테고리의 다른 글
AJP 접속 IP 제한 (0) | 2021.01.09 |
---|---|
포트 셋팅 (0) | 2021.01.04 |