일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 単語
- html
- rails
- 건담
- 일본어
- CSS
- Python
- Flutter
- rails7
- ruby
- springboot
- jsp
- 연습문제
- 日本語
- 인프런
- C로 시작하는 컴퓨터 프로그래밍4판
- 반다이몰
- メソッド
- DART
- 一日一つメソッド
- 자바
- 건담베이스
- 비즈니스일본어
- javascript
- 디지몬
- Spring
- java
- vscode
- nico
- Web
Archives
- Today
- Total
AR삽질러
JSP웹프로그래밍-Hard Carry 프로젝트 본문
728x90
1. main
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>메인화면</title>
</head>
<body>
<h2>JSP Chapter13 프로젝트</h2>
<hr>
<p>
<table border="0">
<tr>
<td>
<form action="login.jsp" method="post">
<input type="submit" value="◀ 관리자 접속하기">
</form>
</td>
<td>
<form action="signup.jsp" method="post">
<input type="submit" value="사용자 접속하기▶">
</form>
</td>
</tr>
</table>
</body>
</html>
2. 회원가입화면
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>회원가입</title>
<script type="text/javascript">
function checkFun()
{
var form = document.user_info;
if(!form.userID.value){
alert("아이디를 입력하세요");
form.userID.focus();
return false;
}
if(!form.userPW.value){
alert("비밀번호를 입력하세요");
form.userPW.focus();
return false;
}
if(!form.userMAIL.value){
alert("메일을 입력하세요");
form.userMAIL.focus();
return false;
}
else return true;
}
</script>
</head>
<body>
Home > 회원가입
<hr>
<form action="insertDB.jsp" name="user_info" method="post" onsubmit=" return checkFun()">
<fieldset style="width=230px">
<legend>회원가입</legend>
아이디 : <br>
<input type="text" name="userID"><br><br>
비밀번호 : <br>
<input type="password" name="userPW"><br><br>
이메일 : <br>
<input type="text" name="userMAIL"><br><br>
<hr>
<div align="left">
<input type="submit" value="◀ 가입하기">
<input type="reset" value="다시작성 ▶">
</div>
</fieldset>
</form>
</body>
</html>
3. DB접속
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>insertDB</title>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
String u_id = request.getParameter("userID");
String u_pw = request.getParameter("userPW");
String u_mail = request.getParameter("userMAIL");
String sql = "insert into members(id,passwd,email) values";
sql += "('" + u_id + "','" + u_pw + "','" + u_mail +"')";
String driverName = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/odbo";
String username = "root";
String password = "123456";
Connection conn = null;
Class.forName(driverName);
conn = DriverManager.getConnection(url, username, password);
Statement sm = conn.createStatement();
int count = sm.executeUpdate(sql);
if(count == 1){
response.sendRedirect("signupSuccess.jsp");
}else{
out.println("회원가입실패");
}
sm.close();
conn.close();
%>
</body>
</html>
4. 회원 등
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>회원 등록 성공</title>
</head>
<body>
Home > 회원 등록 성공
<hr>
축하합니다!<br>
관리자인 경우만 로그인 수행이 가능합니다.<br><br>
<table border="0">
<tr>
<td>
<form action="membership.jsp" method="post">
<input type="submit" value="◀ 사용자 공간 이동">
</form>
</td>
<td>
<form action="login.jsp" method="post">
<input type="submit" value="관리자 모드 이동 ▶">
</form>
</td>
</tr>
</table>
</body>
</html>
5. 회원 전용 공간
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>회원 전용 공간</title>
</head>
<body>
Home > 회원 전용 공간
<hr>
반갑습니다.<br>
여기는 회원 전용 공간입니다.<br>
회월을 탈퇴하려면 버튼을 눌러주세요.<br><br>
<table border="0">
<tr>
<td>
<form action="main.jsp" method="post">
<input type="submit" value="◀ 메인 화면">
</form>
</td>
<td>
<form action="withdraw.jsp" method="post">
<input type="submit" value="탈퇴하기 ▶">
</form>
</td>
</tr>
</table>
</body>
</html>
6. 회원 탈퇴하기
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>회원탈퇴</title>
</head>
<body>
Home > 회원 탈퇴하기
<hr>
<form action="drawCheck.jsp" name="user_info" method="post">
<fieldset style="width:200px">
<legend>회원 탈퇴</legend><p>
아이디 : <br>
<input type="text" name="userID"><br>
<div align="center">
<input type="submit" value="◀ 회원 탈퇴 ▶">
</div><br>
</fieldset>
</form>
</body>
</html>
7. drawCheck
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>drawCheck</title>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
String u_id = request.getParameter("userID");
String sql = "delete from members where id = ?";
String driverName="com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/odbo";
String username = "root";
String password = "123456";
Connection conn = null;
Class.forName(driverName);
conn = DriverManager.getConnection(url, username, password);
PreparedStatement sm = conn.prepareStatement(sql);
sm.setString(1, u_id);
int count = sm.executeUpdate();
if(count == 1){
response.sendRedirect("drawSuccess.jsp");
}else{
response.sendRedirect("drawErr.jsp");
}
sm.close();
conn.close();
%>
</body>
</html>
8. 회원 탈퇴
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>회원 탈퇴</title>
</head>
<body>
Home > 회원 탈퇴
<hr>
회원 탈퇴 실패 ! <br>
아이디를 다시 확인해 주세요.<br>
<form action="withdraw.jsp" name="w_form" method="post">
<p>
<input type="submit" value="◀ 회원 탈퇴 재시도 ▶">
</form>
</body>
</html>
9. 회원 탈퇴 성공
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>회원 탈퇴 성공</title>
</head>
<body>
Home > 회원 탈퇴 성공
<hr>
그동안 감사했습니다.<p>
<table border="0">
<tr>
<td>
<form action="main.jsp" method="post">
<input type="submit" value="메인화면으로">
</form>
</td>
<td>
<form action="signup.jsp" method="post">
<input type="submit" value="다시 가입하기">
</form>
</td>
</tr>
</table>
</body>
</html>
10. 관리자 로그인
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Login Form</title>
<script type="text/javascript">
function checkFun()
{
var f = document.loginForm;
if(f.uID.value == "")
{
alert("아이디를 입력해 주세요");
f.uID.focus();
return false;
}
else if(f.uPW.value == "")
{
alert("비밀번호를 입력해 주세요.");
f.uPW.focus();
return false;
}
else return true;
}
</script>
</head>
<body>
Home > 관리자 로그인
<hr>
<form name="loginForm" action="loginSuccess.jsp" method="post" onsubmit="return checkFun()">
<fieldset style="width:260px">
<legend>관리자 로그인 화면</legend>
<table>
<tr height="30">
<td align="right">아이디 </td>
<td><input type="text" name="uID"></td>
</tr>
<tr height="30">
<td align="right">비밀번호 </td>
<td><input type="password" name="uPW"></td>
</tr>
<tr height="50">
<td></td>
<td><input type="submit" value="로그인 ▶▶"></td>
</tr>
</table>
</fieldset>
</form>
</body>
</html>
11. Login Error
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Login Error</title>
</head>
<body>
Home > 로그인 에러
<hr>
로그인 오류입니다!<bt>
아이디와 비밀번호를 확인하세요.
<form action="login.jsp" name="err_form" method="post">
<p>
<input type="submit" value="다시 로그인 ▶▶">
</form>
</body>
</html>
12. 관리자 로그인
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>관리자 로그인</title>
</head>
<body>
Home > 관리자 로그인
<hr>
<%
String u_id = request.getParameter("uID");
String u_pw = request.getParameter("uPW");
if(u_id.equals("space") && u_pw.equals("123456")){
session.setAttribute("memberId", u_id);
session.setAttribute("memberPw", u_pw);
out.println("새로운 세션 생성 성공 ! <br>");
out.println("관리자 [" + u_id + " ]님이 입장하였습니다.<p>");
}
else
{
response.sendRedirect("loginErr.jsp");
}
%>
<table border="0">
<tr>
<td>
<form action="memberList.jsp" method="post">
<input type="submit" value="◀ 등록 회원 괸리하기">
</form>
</td>
<td>
<form action="logout.jsp" method="post">
<input type="submit" value="로그아웃 ▶">
</form>
</td>
</table>
</body>
</html>
13. 등록 회원 관리
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>MemberList</title>
</head>
<body>
Home > 등록 회원 관리
<hr>
<%
request.setCharacterEncoding("utf-8");
String u_id = request.getParameter("userID");
String u_pw = request.getParameter("userPW");
String u_mail = request.getParameter("userMAIL");
String driverName = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/odbo";
String username = "root";
String password = "123456";
Connection conn = null;
Class.forName(driverName);
conn = DriverManager.getConnection(url, username, password);
Statement sm = conn.createStatement();
ResultSet rs = sm.executeQuery("select id, email, signuptime FROM members");
String str = "";
int count = 1;
while(rs.next()){
str += count + " : " + rs.getString("id") + " / " + rs.getString("email") + " / " + rs.getString("signuptime") + "<br>";
count++;
}
out.println("Home > 회원가입 명단<hr>");
out.println(str);
rs.close();
sm.close();
conn.close();
%>
<hr>
<table border="0">
<tr>
<td>
<form action="withdraw.jsp" method="post">
<input type="submit" value="◀ 회원 탈퇴시키기">
</form>
</td>
</table>
</body>
</html>
14. 로그아웃
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Logout out</title>
</head>
<body>
Home > 로그인 아웃
<hr>
세션을 종료 후 로그 아웃을 수행하였습니다.<br>
그동안 수고 많으셨습니다.
<form action="main.jsp" name="main" method="post">
<p>
<input type="submit" value="메인 화면으로 이동 ▶">
</form>
</body>
</html>
15. DB
728x90
반응형
LIST
'JAVA > JSP' 카테고리의 다른 글
JSP 개인프로젝트(1) (0) | 2023.02.04 |
---|---|
JSP 설치 가이드 (0) | 2023.01.22 |
JSP웹프로그래밍-Hard Carry 연습문제13 (0) | 2023.01.22 |
JSP웹프로그래밍-Hard Carry 연습문제12 (0) | 2023.01.21 |
JSP웹프로그래밍-Hard Carry 연습문제11 (0) | 2023.01.21 |