본문 바로가기
개발/jsp

jsp URLEncoder

by 카앙구운 2015. 9. 25.
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
반응형

'개발 > jsp' 카테고리의 다른 글

jsp URLEncoder  (0) 2015.10.06
jsp 게시판 만들기 1  (0) 2015.09.30
jsp 달력만들기  (0) 2015.09.25
jsp request 메소드 사용  (0) 2015.09.24
jsp 기초(출력,달력, 함수)  (0) 2015.09.24

댓글