<%
request.setCharacterEncoding("euc-kr"); //method=post 한글 깨질때 쓰는방법
//get 일때는 server.xml 에서 <Connector 부분에 URIEncoding="euc-kr"로 설정
%>
ex)
b.jsp
============================================
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!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=EUC-KR">
</head>
<body>
<form action="a.jsp" method="post">
<input type="text" name="a">
<input type="submit">
</form>
</body>
</html>
a.jsp
=========================================================
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!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=EUC-KR">
</head>
<body>
<%
request.setCharacterEncoding("euc-kr");
%>
<%=request.getParameter("a")%>
</body>
</html>
'개발하자 > JSP&Servlet' 카테고리의 다른 글
emp테이블의 ename 출력하고 클릭하면 상세정보 나옴(dept테이블 조인) (0) | 2015.02.25 |
---|---|
DB연동하기 (0) | 2015.02.25 |
getRealPath("/"),getContextPath() (0) | 2015.02.23 |
getInitParameterNames(),getInitParameter() (0) | 2015.02.23 |
getAttribute,getParameter (0) | 2015.02.23 |