강의_6장 request 와 response 객체.pdf

| getContextPath() | JSP 페이지가 속한 웹 어플리케이션의 컨텍스트 패스를 구한다. | 
|---|---|
| getRemoteAddr() | 요청한 호스트의 네트워크 주소를 구한다. | 
| getServerName() | 서버의 이름을 구한다. | 
| getMethod() | 요청 방식이 GET 방식인지 POST 방식 인지를 알려준다. | 
| getProtocol() | 사용 중인 프로토콜을 알려준다. | 
| getRequestURL() | 요청 URL을 구한다. | 
| getQueryString() | 요청 URL 다음에 오는 쿼리 문자열을 구한다. | 
| getRequestURI() | 요청 URL에서 쿼리 문자를 제외한 부분을 구한다. | 
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
	<form method="post" action="response01_process.jsp">
		<p>아 이 디: <input type="text" name="id"></p>
		<p>비밀번호: <input type="text" name="passwd"></p>
		<p><input type="submit" value="전송"></p>
		
	</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
	<%
		String userId = request.getParameter("id");
		String passwd = request.getParameter("passwd");
		
		if(userId.equals("aaa") && passwd.equals("1234")){
			response.sendRedirect("response01_success.jsp");
		}else{
			
			response.sendRedirect("response01_fail.jsp");
		}
	%>
</body>
</html>