데일리로그C:
article thumbnail
Published 2023. 1. 30. 17:48
프로젝트(230130) JAVA/jsp

 

<table border=1 align=center> <!--상단-->
<tr>
<td>
   
</td>
</tr>

</table>

<table border=1 align=center> <!--회원수정-->
<tr>
<td>
<a href=/member/join_up.jsp>회원수정</a>
</td>
</tr>
</table>

 

 


session_id session_level session_name --> left.jsp에 변수명

index.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@ include file="/include/head.jsp" %>



<table width=100% border=0>
	<tr>
		<td class="cat_bx" id="cat_bx">
			<img class="cat_img" src="/img/cat02.jpg">
		</td>
	</tr>
</table>

<%@ include file="/include/foot.jsp" %>


include폴더
head.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<%@ include file="/include/dbconnection.jsp" %>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>project1</title>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<!-- j쿼리 -->
<script src="http://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.4.1.min.js"></script>

<style>
	body {
		margin:0px;
		padding:0px;
	}

	/* 상단바 */
	.upbar {
		width:100% ;
		height:30px ;
		align:right;
		padding-left:310px;
		padding-right: 150px;
		font-size: 13px;
	}
	
	.search {
		border: 1px solid #E0E0E0;
		padding-right: 30px;
	}
	
	.login{
		border: 0px;
		background-color: white;
	}
	
	.join {
		border: 0px;
		background-color: white;
	}
	
	.btn_modal {
        background-color: white;
        border: 0px;
    }
    
    /* 사이드바 */
    .menu {
    	font-size: 20px;
    	font-weight: bold;
    	
    }
</style>
</head>

<body>

<!-- 상단바 -->
<table class=upbar border=0>
	<tr>
		<td height=10 colspan="4"></td>
	</tr>
	<tr>
		<td align=right colspan=4 height=20>
				<!-- <input id="search" type="text" name="search" value="" placeholder="검색내용을 입력하세요."> 돋보기 누르면 뜨는걸로-->
				<img class="icon01" id="icon01" src="/img/icon01.PNG">

		</td>
	</tr>
	<tr>
		<td height=10 colspan="4"></td>
	</tr>

</table>


<hr>

<table width=100% height=700 border=1>
	<tr>
		<!-- 메뉴바-->
		<td width=250>
			<%@ include file="/include/left.jsp" %>
		</td>
		
		<!-- 여백-->
		<td width=100></td>
		
		<!-- 내용 -->
		<td>
		

<%@ include file="/member/login.jsp" %>
<script>
$("#bnt_login").on("click",function(){
	$("#modal_login").show();
});
$("#close_login").on("click",function(){
	$("#modal_login").hide();
});
</script>


left.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
    
<table height=700 border=0>
	<tr>
		<!-- 메뉴바, 카피라이터 -->
		<td>
			<table width=250 height=900 border=1>
				<tr>
					<td id="logo" class="logo">
						<a href="/"><img src="/img/logo(TAL)4.png"></a>
					</td>
				</tr>
				<tr>
					<td height=50></td>
				</tr>
				
				<tr>
					<td align=right colspan=2 height=50>
						<button id="bnt_login" class="login">[로그인]</button> <!-- 버튼 누르면 모달창 오픈 -->
						<a href="/member/join.jsp">[회원가입]</a><br>
						<a id="" class="">[ID·PW 찾기]</a> 
					</td>
				</tr>
				
				<tr>
					<td id="menu" class="menu"> 
						<div><a href="">놀이터</a></div>   <!-- bb4 갤러리형 모듈 -->
						<div><a href="">무료분양</a></div> <!-- bb4 갤러리형 모듈 -->
						<div><a href="">게시판</a></div>   <!--  -->
						<div><a href="">Q&A</a></div>  <!-- bb6 질답 모듈 -->  
					</td>
				</tr>
				<tr>
					<td height=50></td>
				</tr>
				<tr>
					<td style="border-top:1px solid red; height:1px"></td>
				</tr>
				<tr>
					<td id="foot" class="foot">
						<div>
							이용약관 
							개인정보처리방침
						</div>
						<div>
							상호명<br>
							주소<br>
							연락처<br>
							동물판매등록번호<br>
						</div>
						<div>24시간상담운영</div>
						<div>SNS</div>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>


foot.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

		</td>
		 
		<!-- 우 여백 -->
		<td width=100></td>
	</tr>
</table>

</body>
</html>


dbconnection.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<%
//디비 접속	
Class.forName("com.mysql.jdbc.Driver");

String url="jdbc:mysql://localhost:3306/blog";  // DB 이름 : blog

String user="root";

String password="1111";
%>



member 폴더
login.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>

<style>
/* 로그인창 */
	.icon {
		padding-left:10px;
		display:block;
		margin-left:auto;
		margin-right:auto;
	}
	
	.loginbox {
		width=300;
		padding-left: 10;
		padding-right: 10;
		line-height:20px;
	}
	
	.naverbt {
		background-color: #27D34A;
		font-weight: bold;
		font-size:13px;
		color: white;
		height:29px;

	}
	
	.kakaobt {
		background-color: #FEE500;
		font-weight: bold;
		font-size:13px;
		color: white;
	}
	
	a {
		text-decoration-line: none;
		font-size:13px;
	}
	
	.m_id {
		width:300px;
		height: 20px;
	}
	
	.m_pass {
		width:300px;
		height: 20px;
	}
	
	.loginbt {  /* 로그인 버튼(빨) */
		background-color: #A11F24;
		color:white ;
		border: 0px;
		height: 30px;
		font-weight: bold;
		width: 300px;
		padding-top:10px;
		padding-bottom:30px;
		align:center;
	}
	
	.checkbt {  /* 비회원조회 */
		background-color: #A11F24;
		color:white ;
		border: 0px;
		height: 30px;
		font-size:13px;
		font-weight: bold;
		width: 300px;
		padding-top:10px;
		padding-bottom:30px;
		align:center;
	}
	
	
	/* 모달창 */

	.modal_login {  /*모달창*/
		width: 100%;
		height: 100%;  /*높이 설정안하면 수직 가운데정렬 안됨*/
		position: absolute;  /*창 독립*/
		left: 0;
		top: 0;
		display: none;  /*flex하면 고정됨*/
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	
	
	.content_login {  /*내용(로그인창)*/
		width: 380px;
		height: 520px;
		position: relative;
		background-color: #F1F1F1;
		padding-top:20px;
	}
	
	.close_login {  /*닫기버튼*/
		float:left;
        display: inline;
        cursor: pointer;
        text-shadow: 2px 2px 2px gray;
        color: white;  
    }
</style>

<!--모달창 시작-->
<table id="modal_login" class="modal_login">
	<tr>
		<td align=center>
			<div class="content_login">
		        <form name="login" action="login_ok.jsp" method="post">
		            <table class=loginbox border=0>
		            	<tr>
		            		<td colspan="2" id="close_login" class="close_login">X</td>  <!--취소버튼-->
		            	</tr>
		                <tr>
		                    <td align=center colspan="2"><h2>로그인</h2></td>
		                </tr>
		                
		                <tr>
		                    <td colspan="2" height=10></td>
		                </tr>
		                
		                <tr>
		                    <td class="naverbt" width=100% align=center colspan="2">
		                        <div style="float: left"><img class="icon" src="/img/icon02.PNG"></div>
		                        <div style="float:none; line-height: 2;"><a href="https://nid.naver.com/nidlogin.login?mode=form&url=https%3A%2F%2Fwww.naver.com" text-decoration-line: none>네이버로 시작하기</a></div>
		                    </td>
		                </tr>
		                
		                <tr>
		                    <td class="kakaobt" width=100% align=center colspan="2">
		                        <div style="float: left"><img class="icon" src="/img/icon03.PNG"></div>
		                        <div style="float:none; line-height: 2;"><a href="https://accounts.kakao.com/login/?continue=https%3A%2F%2Fkauth.kakao.com%2Foauth%2Fauthorize%3Fencode_state%3Dtrue%26response_type%3Dcode%26redirect_uri%3Dhttps%253A%252F%252Fmember.melon.com%252Foauth.htm%26state%3DCRYT_QoPOExRFFYvp3zu2pt%252Fp8t%252Fb9jh8BRa43Rg%252FLXPgYpcrd0GbC1pE0K8MQBD91IkrmVI34LVyyDEAs3ZX1ctKvA%253D%253D%26through_account%3Dtrue%26prompt%3Dnull%26client_id%3D6cfb479f221a5adc670fe301e1b6690c" text-decoration-line: none>카카오로 시작하기</a></div>
		                    </td>
		                </tr>
		                
		                <tr>
		                    <td colspan="2" height=10></td>
		                </tr>
		                
		                <tr>
		                    <td colspan="2"><hr></td>
		                </tr>
		                
		                <tr>
		                    <td colspan="2" height=10></td>
		                </tr>
		                
		                <tr>
		                    <td colspan="2">
		                        <div><input class="m_id" id="memberid" name="memberid" placeholder="아이디" style="height: 30px"></div>
		                    </td>
		                </tr>
		                <tr>
		                	<td colspan="2">
		                		<div><input class="m_pass" id="password" name="password" placeholder="비밀번호" style="height: 30px"></div>
		                	</td>
		                </tr>
		                
		                <tr>
		                    <td colspan="2" height=5></td>
		                </tr>
		                
		                <tr>
		                    <td colspan="2">
		                        <input id="m_check" name="m_check" type="checkbox">로그인상태유지
		                    </td>
		                </tr>
		                
		                <tr>
		                    <td colspan="2" height=5></td>
		                </tr>
		                
		                <tr>
		                    <td colspan="2">
		                        <button class="loginbt">로그인</button>
		                    </td>
		                </tr>
		                
		                <tr>
		                    <td colspan="2" height=5></td>
		                </tr>
		                
		                <tr>
		                    <td class="a1">
		                        <a href="/member/join.jsp" align=left>회원가입</a>
		                    </td>
		                    <td class="a2" align=right>
		                        <a href="/member/ip_search.jsp">ID·PW 찾기</a>
		                    </td>
		                </tr>
		                
		                <tr>
		                    <td colspan="3" height=10></td>
		                </tr>
		                
		                <tr>
		                    <td colspan="2" ><hr></td>
		                </tr>
		                
		                <tr>
		                    <td colspan="2" height=10></td>
		                </tr>
		                
		                <tr>
		                    <td colspan="2">
		                        <button class="checkbt">비회원 조회</button>  <!-- 모달창으로 만들기 -->
		                    </td>
		                </tr>
		            </table>
		        </form>
		    </div>
		</td>
	</tr>
</table>


login_ok.jsp

<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@ include file="/include/dbconnection.jsp" %>

<!-- 로그인 버튼 누르면 실행 -->
<%
request.setCharacterEncoding("utf-8");

String id = request.getParameter("memberid");
out.print("아이디: " + id + "<br>");

String pass = request.getParameter("password");
out.print("비밀번호: " + pass + "<br>");

String sql = "select * from member where memberid='"+id+"' and password='"+pass+"' ";  // 위에 string 선언 한걸로

Connection con = DriverManager.getConnection(url, user, password);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sql);

String mem_id="";
String mem_pass="";
String mem_name="";
String mem_level="";

if(rs.next()){ 
	mem_id = rs.getString("memberid");
	mem_pass = rs.getString("password");
	mem_name = rs.getString("name");
	mem_level = rs.getString("level");
}

if(id.equals("mem_id") && pass.equals("mem_pass")){  // 입력값이랑 DB 값이 일치한다면
	session.setAttribute("memberid",id);  // session : 해당 브라우저 자체를 종료하지않는 이상 그 정보 계속 살아있음 ("내가만든변수", 값(사용자가 입력한 값))
	session.setAttribute("name", mem_name);
	session.setAttribute("level", mem_level);
}
%>

<script>
	location.href="/";
</script>


join.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<%@ include file="/include/head.jsp" %>

<script>
	function join_ok() {
		if(memberid.value == "") {
			alert("아이디를 입력하세요");
			join.m_id.focus();
			return;
		}
		if(password.value == "") {
			alert("비밀번호를 입력하세요");
			m_pass.focus();
			return;
		}
		if(m_name.value == "") {
			alert("이름을 입력하세요");
			join.m_name.focus();
			return;
		}
		if(id_check2.value == 'n') {
			alert("아이디 중복체크를 하세요.");
			return;
		}
		if($("input:checkbox[name='import_check']").is(":checked")== true){
			location.href="join_ok.jsp"
		} else {  // 아니라면 페이지 그대로 + 경고창
			alert("(필수)개인정보 수집 및 이용동의에 체크를 하세요.");
			return;
		}
		document.join.submit();	 // join을 action(insert.jsp)에 get 방식으로 보내기
	}

</script>

<style>
/* 회원가입창 */
	.h { /* 회원가입 */
		letter-spacing: 15px; 
		font-size: 50px; 
		font-weight: bolder;
		padding-bottom: 10px;
		padding-top: 10px;
            
	}
        
	.input_01 { 
		border: 0px solid #CDCDCD;
		height:33px;
		width:98%;
	}
        
	 .input_02 {  /*yy 상자*/
	     border: 0px solid #CDCDCD;
	     height:33px;
	     width:95%;
	 }
	 
	 .input_03 {  /*dd 상자*/
	     border: 0px solid #CDCDCD;
	     height:33px;
	     width:95%;
	 }
	 
	 select {
	     border: 0px solid red;
	     height:33px;
	     width:100%;
	 }
	 
	 .agree {
	     font-size: 14px;
	     line-height: 2px;
	 }
	 
	 .join_btn {
	     height: 45px;
	     width:100%;
	     padding-bottom: 20px;
	     padding-top: 10px;
	     background-color:#A11F24;
	     border:0px;
	     
	     font-size:20px;
	     color: white;
	     text-align: center;
	     font-weight: bold;
	     letter-spacing: 3px;
	 }	
</style>

<form name="join" action="join_ok.jsp" method="post" onsubmit="return join_ok()">
<table class=joinbox border=0 width=600 align=center>
	<tr>
		<td class="h" align=center colspan="4">회 원 가 입</td>
	</tr>
	
	<tr>
		<td colspan="3" height=10px></td>
	</tr>
	
	<tr>
		<td>  <!-- 아이디 -->
			<table width=600 border=0 style="border: 1px solid #DADADA; background-color: white">
				<tr>
					<td> <input class="input_01" id="memberid" name="memberid" placeholder="아이디(필수)"></td> 
					<td width=80 > <input type="button" value="중복 확인" id="id_check2" name="id_check2" onclick="join_ok()" style="padding: 3px 7px 3px 7px;"> </td>
				</tr>
			</table>
		</td>
	</tr>
</table>

<table border=0 width=600 align=center>
	<tr>
		<td colspan="3" height=10px></td>
    </tr>

    <tr>
		<td>  <!-- 비밀번호 -->
			<table width=300 border=0 style="border: 1px solid #DADADA; background-color: white">
				<tr>
					<td> <input name="password" id="password" class="input_01" placeholder="비밀번호(필수)" > </td> 
        		</tr>
    		</table>
		</td>
		<td>
    		<table width=300  border=0 style="border: 1px solid #DADADA; background-color: white">
				<tr>
               		<td> <input name="password2" id="password2" class="input_01" placeholder="비밀번호 확인(필수)"> </td> 
          		</tr>
       		</table>
   		</td>
	</tr>
	<tr>
	     <td colspan="3" height=10px></td>
	</tr>
	<tr>
		<!--<td colspan="3" height=20> 비밀번호가 일치하지 않습니다.</td>  비밀번호 , 비밀번호 확인이 일치하지 않다면 띄우기 -->
	</tr>

	<tr>
	     <td colspan="3" height=10px></td>
	</tr>

	<tr>
	   <td colspan="3">
	       <table width=100% border=0 style="border: 1px solid #DADADA; background-color: white">
	           <tr>
	               <td> <input class="input_01" id="m_name" name="m_name" placeholder="이름(필수)"></td> 
	           </tr>
	       </table>
	   </td>  
	</tr>

	<tr>
	     <td colspan="3" height=10px></td>
	</tr>

	<tr>
	    <td colspan="3">  <!-- 생년월일 & 성별 -->
	       <table width=600 border=0>
	           <tr>
					<td style="width:250px; border:1px solid #DADADA; background-color: white"> <input class="input_02" id="yy" name="yy" placeholder="년(4자)"> </td>
					<td width=5> </td>
					<td style="width:100px; background-color: white;border:1px solid #DADADA;"> 
				       <select name="mm" id="mm">
				           <option value="0">월</option>
				           <option value="1">1</option>
				           <option value="2">2</option>
				           <option value="3">3</option>
				           <option value="4">4</option>
				           <option value="5">5</option>
				           <option value="6">6</option>
				           <option value="7">7</option>
				           <option value="8">8</option>
				           <option value="9">9</option>
				           <option value="10">10</option>
				       </select> 
					</td>
					<td width=5px> </td>
					<td style="width:100px;border:1px solid #DADADA; background-color: white"> <input class="input_03" name="dd" id="dd" placeholder="일"> </td>
					<td width=20px> </td>
					<td style="width:150px;border:1px solid #DADADA; background-color: white"> 
						<select name="gender" id="gender">
							<option value="0">성별</option>
							<option value="1">남자</option>
							<option value="2">여자</option>
						</select> 
	               </td>
	           </tr>
	       </table>
	    </td> 
	</tr>
</table>

<table border=0 width=600 align=center>
	<tr>
	     <td colspan="2" height=10px></td>
	</tr>

	<tr> <!-- 이메일 -->
    	<td>
    		<table width=450px style="border: 1px solid #DADADA; background-color: white">
    			<tr>
    				<td><input class="input_01" id="email1" name="email1"></td>
    				<td> @ </td>
    				<td><input class="input_01" id="email2" name="email2"></td>
    			</tr>
    		</table>	
		</td>
		
		<td width=150 style="border: 1px solid #DADADA; background-color: white">
			<select id="domain" name="domain" onchange="email2.value = this.value">
				<option value="===직접입력==="> ===직접입력=== </option>
				<option value="naver.com">naver.com</option>
				<option value="gmail.com">gmail.com</option>
				<option value="nate.com">nate.com</option>
			</select>
		</td>
    </tr>

    <tr>
		<td colspan="3" height=10px></td>
    </tr>
</table>    

<table width=600 align=center>   
    <tr>
		<td>  <!-- 전화번호 -->
			<table width=120px  border=0 style="border: 1px solid #DADADA; background-color: white">
				<tr>
					<td> 
						<select name="country" id="country">
							<option value="1"> 가나 +233 </option>
							<option value="2"> 가봉 +241</option>
							<option value="3" selected> 대한민국 +82</option>
							<option value="4"> 미국/캐나다 +1</option>
							<option value="5"> 프랑스 +33</option>
						</select>
					</td>
				</tr>
			</table>
		</td>
		<td>
			<table width=300px border=0 style="border: 1px solid #DADADA; background-color: white">
				<tr>
    				<td class="phone"> <input class="input_01" name="phone" id="phone" placeholder="전화번호(필수)"></td> 
    				<td width=50 style="padding-right: 5px"> <input type="button" value="인증번호" onclick="join_ok()" style="padding: 3px 7px 3px 7px;"> </td>
				</tr>
       		</table>
       	</td>
       	<td>
       		<table width=175px  border=0 style="border: 1px solid #DADADA; background-color: white">
				<tr>
                   <td> <input class="input_01" placeholder="인증번호 입력하세요"> </td>
               </tr>
           </table>
		</td> 
	</tr>

    <tr>
         <td colspan="2" height=10px></td>
    </tr>
</table>

<table width=600 align=center border=0>
	<tr> <!-- 주소 -->
		<td>
			<table width=600 border=0 style="border: 1px solid #DADADA; background-color: white">
				<tr>
					<td> <input type="text" class="input_01" id="sample4_postcode" name="zipcode" placeholder="우편번호"></td> 
					<td width=30px > <input type="button" onclick="sample4_execDaumPostcode()" value="검색" style="padding: 3px 7px 3px 7px;"><br> </td>
				</tr>
			</table>		
		</td>
	</tr>
</table>

<table width=600 align=center border=0>
	<tr>
         <td colspan="2" height=1px></td>
    </tr>
	<tr>
		<td style="border: 1px solid #DADADA; background-color: white">
			<input type="text" class="input_01" id="sample4_roadAddress" name="zipcode1" placeholder=" 도로명주소">
			<span id="guide" style="color:#999;display:none"></span>
		</td>
		<td style="border: 1px solid #DADADA; background-color: white">
			<input type="text" class="input_01" id="sample4_jibunAddress" name="zipcode2" placeholder=" 지번주소">
		</td>
	</tr>
	<tr>
		<td colspan="2" height=1px></td>
	</tr>
	<tr>
		<td colspan="2" style="border: 1px solid #DADADA; background-color: white">
			<input type="text" class="input_01" id="sample4_detailAddress" name="zipcode3" placeholder=" 상세주소">
		</td>
	</tr>
	<tr>
		<td colspan="2" height=20px></td>
	</tr>
</table>

	

	
<table width=600 align=center border=0>    
    <tr>
        <td class="agree" width=550 height=20px><input type="checkbox" name="import_check"> <span style="color: red">(필수) </span>개인정보 수집 및 이용동의</td>
		<td width=50 style="text-align: right; font-size: 20px; " >&gt;</td>
	</tr>

	<tr>
	    <td class="agree" width=550 height=20px><input type="checkbox"> (선택) 개인 정보 제3자 제공동의</td>
	    <td width=50 style="text-align: right; font-size: 20px; " >&gt;</td>
	</tr>

	<tr>
	    <td class="agree" width=550 height=20px><input type="checkbox"> (선택) email 및 SMS 광고성 정보 수신동의</td>
	    <td width=50 style="text-align: right; font-size: 20px; " >&gt;</td>
	</tr>

	<tr>
	     <td colspan="2" height=20px></td>
	</tr>

	<tr>    
    	<td colspan="2" width=600 height=40px> 
			<input class="join_btn" type="button" value="동의하고 가입하기" onclick="join_ok()">
        </td>
    </tr>
    
    <tr>
         <td colspan="2" height=20px></td>
    </tr>
</table>
</form>

<script src="//t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js"></script>
<script>
    //본 예제에서는 도로명 주소 표기 방식에 대한 법령에 따라, 내려오는 데이터를 조합하여 올바른 주소를 구성하는 방법을 설명합니다.
    function sample4_execDaumPostcode() {
        new daum.Postcode({
            oncomplete: function(data) {
                // 팝업에서 검색결과 항목을 클릭했을때 실행할 코드를 작성하는 부분.

                // 도로명 주소의 노출 규칙에 따라 주소를 표시한다.
                // 내려오는 변수가 값이 없는 경우엔 공백('')값을 가지므로, 이를 참고하여 분기 한다.
                var roadAddr = data.roadAddress; // 도로명 주소 변수
                var extraRoadAddr = ''; // 참고 항목 변수

                // 법정동명이 있을 경우 추가한다. (법정리는 제외)
                // 법정동의 경우 마지막 문자가 "동/로/가"로 끝난다.
                if(data.bname !== '' && /[동|로|가]$/g.test(data.bname)){
                    extraRoadAddr += data.bname;
                }
                // 건물명이 있고, 공동주택일 경우 추가한다.
                if(data.buildingName !== '' && data.apartment === 'Y'){
                   extraRoadAddr += (extraRoadAddr !== '' ? ', ' + data.buildingName : data.buildingName);
                }
                // 표시할 참고항목이 있을 경우, 괄호까지 추가한 최종 문자열을 만든다.
                if(extraRoadAddr !== ''){
                    extraRoadAddr = ' (' + extraRoadAddr + ')';
                }

                // 우편번호와 주소 정보를 해당 필드에 넣는다.
                document.getElementById('sample4_postcode').value = data.zonecode;
                document.getElementById("sample4_roadAddress").value = roadAddr;
                document.getElementById("sample4_jibunAddress").value = data.jibunAddress;
                
                // 참고항목 문자열이 있을 경우 해당 필드에 넣는다.
                if(roadAddr !== ''){
                    document.getElementById("sample4_extraAddress").value = extraRoadAddr;
                } else {
                    document.getElementById("sample4_extraAddress").value = '';
                }

                var guideTextBox = document.getElementById("guide");
                // 사용자가 '선택 안함'을 클릭한 경우, 예상 주소라는 표시를 해준다.
                if(data.autoRoadAddress) {
                    var expRoadAddr = data.autoRoadAddress + extraRoadAddr;
                    guideTextBox.innerHTML = '(예상 도로명 주소 : ' + expRoadAddr + ')';
                    guideTextBox.style.display = 'block';

                } else if(data.autoJibunAddress) {
                    var expJibunAddr = data.autoJibunAddress;
                    guideTextBox.innerHTML = '(예상 지번 주소 : ' + expJibunAddr + ')';
                    guideTextBox.style.display = 'block';
                } else {
                    guideTextBox.innerHTML = '';
                    guideTextBox.style.display = 'none';
                }
            }
        }).open();
    }
</script>

<%@ include file="/include/foot.jsp" %>


join_ok.jsp

<%@page import="java.sql.Statement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@ include file="/include/dbconnection.jsp" %>

<!-- 회원가입 버튼 누르면 실행 -->

<%
request.setCharacterEncoding("utf-8");

String id = request.getParameter("memberid");
String pass = request.getParameter("password");
String name = request.getParameter("m_name");
String email = request.getParameter("email1") + "@"+ request.getParameter("email2");
String phone = request.getParameter("phone");

String z = request.getParameter("zipcode");
String z1 = request.getParameter("zipcode1");
String z2 = request.getParameter("zipcode2");
String z3 = request.getParameter("zipcode3");
String z4 = request.getParameter("zipcode4");

out.print("아이디:" + id + "<br>");
out.print("비밀번호:" + pass + "<br>");
out.print("이름:" + name + "<br>");
out.print("이메일:" + email + "<br>");


// DB에 저장
String sql ="insert into member values('"+id+"','"+pass+"','"+name+"','"+email+"','"+phone+"','"+z+"','"+z1+"','"+z2+"','"+z3+"','1')";
out.print(sql);
Connection con = DriverManager.getConnection(url, user, password);
Statement stmt = con.createStatement();
stmt.executeUpdate(sql);

%>
 
<script>
	location.href="/";
</script>


ip_search.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!--  아이디 비번 찾기 -->


update.jsp

<%@page import="java.sql.Statement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>


<%@ include file="/include/head.jsp" %>

<!-- 수정한거 DB에 업데이트 저장 -->

<% 
request.setCharacterEncoding("utf-8");

String id = request.getParameter("memberid");
String pass = request.getParameter("password");
String name = request.getParameter("name");
String email = request.getParameter("email1") + "@"+ request.getParameter("email2");
String phone = request.getParameter("phone");

String z = request.getParameter("zipcode");
String z1 = request.getParameter("zipcode1");
String z2 = request.getParameter("zipcode2");
String z3 = request.getParameter("zipcode3");
String z4 = request.getParameter("zipcode4");

// DB에 저장
String sql = "update member set password='"+pass+"', name='"+name+"', email='"+email+"', phone='"+phone+"', zipcode='"+z+"', zipcode1='"+z1+"',zipcode2='"+z2+"',zipcode3='"+z3+"',zipcode4='"+z4+"' where memberid='"+id+"' ";

Connection con = DriverManager.getConnection(url, user, password);
Statement stmt = con.createStatement();
stmt.executeUpdate(sql);
%>

<script>
	alert("수정되었습니다");
	location.href="/member/join_modify.jsp";
</script>

 

'JAVA > jsp' 카테고리의 다른 글

비밀번호 일치 유무 알려주기  (0) 2023.02.13
프로젝트1  (0) 2023.02.01
모달창  (0) 2023.01.30
bb5 복습  (0) 2023.01.29
230127_추가내용2  (0) 2023.01.27
profile

데일리로그C:

@망밍

포스팅이 도움됐다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!

profile on loading

Loading...