IT/개발

jsp URLEncoder

카앙구운 2015. 10. 6. 17:47
728x90
반응형

@특정 값을 보내는 방법1 redirectEncodingTest.jsp

----------------------------------------------------------------<%@page import="java.net.URLEncoder"%>

<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

<!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>

<%

String value="자바abcD";

String encodedValue=URLEncoder.encode(value,"UTF-8");

response.sendRedirect("../study_jsp/redirectEncodingTest_sub.jsp?            name="+encodedValue);

%>


</script>

</body>

</html>

================================================================

@특정 값을 보내는 방법 1-1 redirectEncodingTest_sub.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">

<title>Insert title here</title>

</head>

<body>

<%= request.getParameter("name") %>

</body>

</html>

================================================================


728x90
반응형