Web/JSP
JSP #15 Servlet에서 입력값 한글 지원
언덕너머에
2015. 2. 5. 17:41
- get 방식
Tomcat Server 설정파일인 server.xml파일에 <Connector>태그에 다음값을 추가한다.
URIEncoding="UTF-8"
예)
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1"
redirectPort="8443" URIEncoding="UTF-8"/>
* Tomcat Server 실행중이라면 ReStart 해줘야 함.
- post 방식
request.setCharacterEncoding("UTF-8"); 추가
예)
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
......
}