HTTP Request Post방식
- 서버에 데이터를 전송하는 용도
- 데이터가 url에 묻어가지않고 정송객체의 메세지 바디를 통해 전달함
- 보안성이 강함
- 반드시 html form태그가 필요함
- 데이터 양의 제한이 없음
- request.setCharacterEncoding("utf-9");로 인코딩함
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>post1번예시</title>
</head>
<body>
<form action="req_post02.jsp" method="post">
아이디 : <input type="text" name="id"><br>
이메일 : <input type="email" name="email"><br>
<input type="submit" value="확인"><br>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!-- 인코딩을 request.setCharacterEncoding("UTF-8"); 사용해서함 -->
<%
request.setCharacterEncoding("UTF-8"); //한글을 utf-8로 인코딩 처리
String id = request.getParameter("id");
String email = request.getParameter("email");
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>post1번예시</title>
</head>
<body>
<%=id %><br>
<%=email %>
</body>
</html>
'jsp' 카테고리의 다른 글
2022_11_30 jsp REQUEST 연습 BMI계산기 (0) | 2022.11.30 |
---|---|
2022_11_29 post방식 연습문제 (0) | 2022.11.29 |
2022_11_29 jsp HttpRequest Get방식 예시2 (0) | 2022.11.29 |
2022_11_29 HttpRequest의 Get방식 (0) | 2022.11.29 |
2022_11_29 랜덤 로또번호 만들기 (0) | 2022.11.29 |
댓글