메뉴 건너뛰기

2019.01.09 10:29

회원가입

조회 수 918 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

1.회원가입 페이지


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
    <script>
    $(document).ready(function() {
 
        
        //회원가입
        $("#btnJoin").click(function (){
            
            
            location.href="/web02/member/join.jsp";
            
            
        });
 
 
<input type="button" value="회원가입" id="btnJoin">
 
 
cs




2.회원가입 페이지


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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE  >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="http://code.jquery.com/jquery-3.1.0.js">
    
</script>
 
<script>
    $(document).ready(function() {
 
        //버튼클릭 이벤트
        $("#btnJoin").click(function() {
        
            //폼데이터를 서버에 제출
            document.form1.submit();
 
        });
 
    });
</script>
 
</head>
<body>
 
 
    <h2>회원가입</h2>
 
 
    <form name="form1" method="post" action="/web02/member_servlet/join.do">
 
        <table border="1" width="700px">
            <tr>
                <td>이름</td>
                <td><input type="text" name="name" id="name"></td>
            </tr>
 
 
            <tr>
                <td>아이디</td>
                <td><input type="text" name="userid" id="userid"></td>
            </tr>
 
 
            <tr>
                <td>비밀번호</td>
                <td><input type="password" name="passwd" id="passwd"></td>
            </tr>
 
 
            <tr>
                <td>비밀번호확인</td>
                <td><input type="password" name="passwd2" id="passwd2"></td>
            </tr>
 
 
            <tr>
                <td>이메일</td>
                <td><input type="email" name="email" id="email"></td>
            </tr>
 
 
            <tr>
                <td>폰번호</td>
                <td><input type="text" name="hp" id="hp"></td>
            </tr>
 
 
            <tr>
                <td>우편번호</td>
                <td><input type="text" name="zipcode" id="zipcode"></td>
            </tr>
 
 
            <tr>
                <td>주소</td>
                <td><input type="text" name="address1" id="address1"></td>
            </tr>
 
 
            <tr>
                <td>주소상세</td>
                <td><input type="text" name="address2" id="address2"></td>
            </tr>
 
 
            <tr>
 
                <td  align="center" colspan="2">
                <input type="button" value="회원가입" id="btnJoin"> 
                <input type="reset" value="취소">
 
                </td>
            </tr>
 
        </table>
    </form>
 
</body>
</html>
cs



3. 컨트롤





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
32
} else if (url.indexOf("join.do"!= -1) {
 
            String userid = request.getParameter("userid");
            String passwd = request.getParameter("passwd");
            String name = request.getParameter("name");
            String email = request.getParameter("email");
            String hp = request.getParameter("hp");
            String zipcode = request.getParameter("zipcode");
            String address1 = request.getParameter("address1");
            String address2 = request.getParameter("address2");
 
            // form 태그의 name속성
            MemberDTO dto = new MemberDTO(userid, passwd, name, email, hp, zipcode, address1, address2);
 
            // insert요청
            int result=dao.memberInsert(dto);
 
            
            // if 문
            
            String message= result=="fail""success";
 
            
            
            // 페이지 이동
 
            String page = path + "/member/main.jsp?message="+message;
            response.sendRedirect(page);
 
        }
 
    }
cs



4. main 페이지


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
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE  >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
 
    <%
        String message = request.getParameter("message");
 
        String str = "";
 
        //자바에서는 이퀄스 사용
        if (message.equals("success")) {
 
            str = "회원가입이 완료";
 
        } else {
 
            str = "회원가입 실패 ";
 
        }
    %>
 
    <h2><%=str%></h2>
 
</body>
</html>
cs

List of Articles
번호 제목 날짜 조회 수
45 JSP 동작 원리, 내부 객체 file 2017.09.12 3579
44 request, response file 2017.09.12 3220
43 지시자(Directive) file 2017.09.12 3123
42 주석(comments) file 2017.09.12 3114
41 파라미터를 배열 형식으로 받기 2021.03.25 1428
40 MVC 패턴 & 도서 목록 컨트롤러에서 해당 URL 받아서 처리하기 2019.01.09 1405
39 로그인 & AJAX 비동기 방식으로 처리&암호화&정규표현식 2019.01.09 1249
38 jsp 웹 멀티업로드 프로그램 file 2019.01.08 1235
37 수정 삭제 2019.01.09 1075
36 태그문자&공백문자&줄바꿈 문자 처리 file 2019.01.09 1027
35 한줄메모 삽입 & AJAX file 2019.01.09 975
34 각종 체크 &우편번호 2019.01.09 958
33 한줄메모 목록 리스트 AJAX file 2019.01.09 928
» 회원가입 2019.01.09 918
31 DBCP 커넥션 풀 file 2019.01.09 905
30 아이디 체크 2019.01.09 895
29 페이지 화면 이동방식 file 2019.01.09 893
28 Get 방식과 Post 방식 2019.01.16 877
27 JSP - DBCP 커넥션 풀 file 2021.03.27 833
26 filter 필터 &한글처리 file 2019.01.09 829
Board Pagination Prev 1 2 3 4 Next
/ 4

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved