index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<a href="index.jsp?han=한글">Send GET</a><br>
<form name="hanForm" method="POST" action="index.jsp">
<input type="hidden" name="han" value="한글"/>
<input type="submit" value="Send POST"/>
</form>
</body>
</html>
index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String han = request.getParameter("han");
if(han == null || han.equals(""))
han="한글";
//String charsets[] = {"euc-kr", "ksc5601", "iso-8859-1", "utf-8"};
//for(int i=0;i<charsets.length;i++)
//for(int j=0;j<charsets.length;j++)
//System.out.println(charsets[i] + " to " + charsets[j] + " : " + new String(han.getBytes(charsets[i]), charsets[j]));
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%=han + ": " + han.getBytes().length + " Bytes "%><br/>
<a href="index.jsp?han=<%=han %>">Send GET</a><br>
<form name="hanForm" method="POST">
<input type="hidden" name="han" value="<%=han %>"/>
<input type="submit" value="Send POST"/>
</form>
</body>
</html>
catalrina home/conf/server.xml
...
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8" useBodyEncodingForURI="true"/>
...
eclipse
window > preferences > Web > CSS Files, HTML Files, JSP Files > Encoding: ISO 10646/Unicode(UTF-8)
eclipse
window > preperences > Geneeral > Content Types > Text > Default encoding : UTF-8 > Update
eclipse
servers > Open launch configration > Common > Encoding > Other UTF-8
WEB-INF/web.xml
<!-- CharacterEncodingFilter -->
<filter>
<filter-name>Encoding Filter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Encoding Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
WEB-INF/lib
org.springframework.web.jar
org.springframework.beans.jar
org.springframework.context.jar
org.springframework.core.jar
commons-logging.jar
'Java' 카테고리의 다른 글
[jad] 사용 패키지 역컴파일 (0) | 2011.11.07 |
---|---|
window java background start.bat, stop.bat (0) | 2011.09.30 |
[JEUS 6] 다른 프레임에서 세션아이디가 변하는 경우 (0) | 2008.12.05 |
iBATIS SQL Maps 튜토리얼 (0) | 2008.09.23 |
iBATIS SQL Maps 튜토리얼 (0) | 2008.09.04 |