Jsp&Servlet
Servlet 한글 처리
살구르
2017. 1. 23. 11:47
1. 서버->클라이언트 (HttpServletResponse setContentType)
response.setContentType("text/html;charset=utf-8");
2. 클라이언트->서버 (HttpServletRequest setCharacterEncoding)
1)post 방식
request.setCharacterEncoding("utf-8");
2)get 방식
server.xml 에서
Connector port 8080의 URIEncoding="UTF-8" 로 설정
<Connector connectionTimeout="20000" port="9090" protocol="HTTP/1.1" redirectPort="8443" URIEncoding="UTF-8"/>
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="UTF-8" />
-->