728x90
728x90
= request03 =
< 26 input-password >
<h1>로그인</h1>
<!-- form>{id}+input+br+{pw}+input+br+input:s -->
<form action="" method="post">
id <input type="text" name="userid">
<br>
pw <input type="password" name="password">
<br>
<input type="submit" value="로그인">
<hr>
userid : <%=request.getParameter("userid") %> <br>
password : <%=request.getParameter("password") %> <br>
</form>
< 27 get-post >
= get과 post에 대한 설명 =
<h1>get</h1>
<ul>
<li>주소에 노출</li>
<li>길이의 제한</li>
</ul>
<h1>post</h1>
<ul>
<li> 주소에 노출되지 않음 (body에 )</li>
<li> 길이의 제한 없음</li>
</ul>
길이의 제한이 얼마나 되는지를 모르니까 나중에 찾아볼 것
< 28 get >
<h1>get</h1>
<form action=""method="get">
<input type="text" name="name">
<input type="text" name="age">
<input type="submit" value="전송">
<!-- 정보찾아보고싶으면 f12 - network -->
< 29 post >
<h1>post</h1>
<!-- input:text+input:text+input:s -->
<form action=""method="post">
<input type="text" name="name" id="">
<input type="text" name="age" id="">
<input type="submit" value="전송">
</form>
< 30 login >
<%--id, password 파라미터를 post 방식 전송 --%>
<form action="" method="post">
id : <input type="text" name="id" id=""> <br>
pw : <input type="password" name="password" id=""> <br>
<inputtype="submit" value="로그인">
</form>
<%--
id가 myid / password가 mypassword 일 때만
로그인 성공 메시지 출력
그렇지 않으면
'아이디나 패스워드가 일치하지 않습니다' 메시지 출력
--%>
<p>
<%
String userid = request.getParameter("id");/*이 값은 위에 name값 */
String userpw = request.getParameter("password");
out.print("<p>");
if (userid != null && userpw != null) {
if (userid.equals("myid") && userpw.equals("mypassword")) {
out.print("로그인 성공");
} else {
out.print("아이디나 패스워드가 일치하지 않습니다");
}
out.print("<p>");
}
%>
</p>
식 짜기 연습용이었던 듯!
< 31 login >
<%--id, password 파라미터를 post 방식 전송 --%>
<form action="" method="post">
id : <input type="text" name="id" id=""> <br>
pw : <input type="password" name="password" id=""> <br>
<input type="submit" value="로그인">
</form>
<%--
id가 myid / password가 mypassword 일 때만
로그인 성공 메시지 출력
그렇지 않으면
'아이디나 패스워드가 일치하지 않습니다' 메시지 출력
--%>
<p>
<%
String userid = request.getParameter("id");/*이 값은 위에 name값 */
String userpw = request.getParameter("password");
out.print("<p>");
if (userid != null && userpw != null) {
if (userid.equals("myid") && userpw.equals("mypassword")) {
out.print("로그인 성공");
} else {
out.print("<script>");
out.print("alert('아이디나 패스워드가 일치하지 않습니다')");
out.print("</script>");
}
}
%>
</p>
< 32 signup >
<form action="" >
이름 : <input type="text" name="name" id=""> <br>
이메일 : <input type="text" name="email" id=""> <br>
패스워드 : <input type="text" name="password" id=""> <br>
<input type="submit" value="가입">
</form>
<hr>
<%
String name = request.getParameter("name");
String email=request.getParameter("email");
String pw = request.getParameter("password");
%>
<h1>가입정보</h1>
이름 : <%=name%> <br>
이멜 : <%=email%> <br>
암호 : <%=pw%> <br>
< 33 signup-form >
<form action="/myjsp_study/02request/day03/34signup-process.jsp" method = "post">
<input type="text" name="name" id="" placeholder="아이디">
<br>
<input type="email" name="email" id=""placeholder="이메일">
<br>
<input type="password" name="password" id=""placeholder="암호">
<br>
<input type="submit" value="가입">
</form>
< 34 signup-process >
<h1>회원 정보</h1>
id : <%=request.getParameter("name") %> <br>
email : <%= request.getParameter("email") %> <br>
pw : <%= request.getParameter("password") %>
<hr>
<a href="/myjsp_study/02request/day03/34signup-process.jsp">33번 파일로 돌아가기</a>
< 35 login-form >
<h1>로그인</h1>
<!-- <form action="/myjsp/02request/36login-process.jsp" method="post"> -->
<form action="<%= request.getContextPath() %>/02request/day03/36login-process.jsp" method="post">
<input type="text" name="id" placeholder="아이디">
<br>
<input type="password" name="pw" placeholder="암호">
<br>
<input type="submit" value="로그인">
</form>
< 36 login-process >
<%
String id = request.getParameter("id");
String pw = request.getParameter("pw");
if (id != null && pw != null) {
if (id.equals("myid") && pw.equals("mypassword")) {
%>
<h1>로그인 성공</h1>
<%
} else {
%>
<h1>아이디나 패스워드가 일치하지 않습니다.</h1>
<!-- <a href="/myjsp/02request/35login-form.jsp">로그인화면으로 돌아가기</a> -->
<a href="<%= request.getContextPath() %>/02request/day03/35login-form.jsp">로그인화면으로 돌아가기</a>
<%
}
}
%>
< 37 context-root >
<h1>context path (context root)</h1>
context root : <%= request.getContextPath() %>
= JSP기초 =
< 01 include-directive-main >
<%--sub 콘텐트 삽입 --%>
<%@ include file="/03module/day03/01include-directive-sub.jsp" %>
<h1>훌륭한 푸터</h1>
< 01 include-directive-sub >
<div>cooool content</div>
< 02 page1 >
<h1>첫번째 페이지 내용들.</h1>
<%--02sub.jsp내용이 include directive 사용하여 추가 --%>
<%@ include file = "/03module/day03/02sub.jsp" %>
< 02 page2 >
<h2>두번쨰 페이지 내용들!</h2>
<%--02sub.jsp내용이 include directive 사용하여 추가 --%>
<%@ include file = "/03module/day03/02sub.jsp" %>
< 02sub >
<div>
<hr>
<span>2021 github Inc,</span>
<span>Terms</span>
<span>Privacy</span>
<span>Security</span>
<span>Status</span>
<span>Docs</span>
<span>Pricing</span>
</div>
< 03include-action-main >
<p>standard action tag ((표준) 액션 태그)</p>
<p>ex) jsp:include, jsp:forward, jsp:param, jsp:body</p>
<hr>
<h1>include 액션 태그</h1>
<jsp:include page="/03module/day03/03include-action-sub.jsp"></jsp:include>
<%--action은 메소드 느낌 directive는 ctrl-c,v느낌
둘의 큰 차이점은 request를 가져오느냐 안가져오느냐의 차이 --%>
< 03include-action-sub >
<div>
서브 파일 콘텐츠
</div>
728x90
'수업 복습하기 > JSP' 카테고리의 다른 글
Day 04 - module02 + path + attribute01 (0) | 2021.12.13 |
---|---|
Day 02 - request02 (0) | 2021.11.19 |
Day 01 - JSP 기초 + request 01 (2) | 2021.11.17 |
수업시간 내용 압축 정리 (0) | 2021.10.25 |