Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- ajax
- php thumbnail
- rss
- 디즈니씨
- Lift
- Node.js
- 스킨 스쿠버
- docker
- 메일왕창보내는법
- iBatis
- 명사 분석기
- flex3
- 나의 취미
- 명사 뽑아내기
- 책이야기
- Eclipse
- 주식이야기
- 명사 추출기
- nodejs express
- node.js web framework
- C/C++
- php
- scala
- 도커
- 베트남어
- ror실행
- Cross
- 나의 프로젝트
- ejb
- express for node.js
Archives
- Today
- Total
nkdk의 세상
29장 회원 가입 및 로그인 아웃 전부 jsp 파일 본문
이번에는 jsp 파일입니다.
idCheck.jsp
LogError.jsp
Login.jsp
LoginProc.jsp
Logout.jsp
MemberInsert.jsp
register.jsp
RegisterProc.jsp
script.js
style.css
ZipCheck.jsp
idCheck.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<jsp:useBean id="memMgr" class="pac.MemberMgr"></jsp:useBean>
<%
String mem_id = request.getParameter("mem_id");
boolean chk = memMgr.checkId(mem_id);
%>
<html><head>
<link href="style.css" rel="stylesheet" type="text/css">
<title>ID 중복 검사</title>
</head>
<body bgcolor="cyan"><center><p>
<b><%=mem_id %></b>
<%
if(chk)
out.println("는 이미 존재하는 아이디 입니다.<p>");
else
out.println("는 사용 가능합니다.<p>");
%>
<a href="#" onclick="self.close()">닫기</a>
</center>
</body></html>
LogError.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"
%>
<html><head><link href="style.css" rel="stylesheet" type="text/css"></head>
<body><center>
<b>로그인에 실패하셧습니다.</b><p>
아이디와 비밀번호를 다시 확인하세요.<p>
<input type=button value="다시쓰기"
onclick="history.back">
</center></body></html>
Login.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<%
String mem_id = (String)session.getAttribute("idKey");
%>
<html><head>
<title>로그인 화면</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="script.js"></script>
</head><body><br><br><br><center>
<%
if(mem_id != null) {
%>
<b>등록된 회원으로 제한된 기능을 보여줍니다.</b><p>
<a href="Logout.jsp">로그아웃</a>
<%
} else {
%>
<form name="frm" method=post action="LoginProc.jsp">
<table><tr><td align=center colspan=2><h3>로그인</h3></td></tr>
<tr><td>아이디</td><td><input type=text name=mem_id></td></tr>
<tr><td>비밀번호</td><td><input type=passwd name=mem_passwd></td></tr>
<tr><td colspan=2>
<input type=button value="로그인" onclick="loginCheck()">&
<input type=button value="회원가입" onclick="memberReg()">&
</td>
</tr></table></form>
<% } %>
</center>
</body>
</html>
LoginProc.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<jsp:useBean id="memMgr" class="pac.MemberMgr"></jsp:useBean>
<%
String mem_id = request.getParameter("mem_id");
String mem_passwd = request.getParameter("mem_passwd");
boolean b = memMgr.loginCheck(mem_id, mem_passwd);
if(b) {
session.setAttribute("idKey", mem_id);
response.sendRedirect("Login.jsp");
}else
response.sendRedirect("LogError.jsp");
%>
Logout.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<%
// session.removeAttribute("idKey");
session.invalidate();
%>
<script>
alert("로그아웃 되었습니다.");
location.href("Login.jsp");
</script>
MemberInsert.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR" %>
<% request.setCharacterEncoding("EUC-KR"); %>
<jsp:useBean id="data" class="pac.MemberBean" />
<jsp:setProperty property="*" name="data" />
<jsp:useBean id="mgr" class="pac.MemberMgr" />
<%
if(mgr.saveData(data)) {
out.println("회원 가입 성공!!!");
out.println("<a href=Login.jsp>로그인</a>");
}else {
out.println("가입 실패! 다시 해보세요. 아님 관리자!");
out.println("<a href=Register.jsp>다시 가입</a>");
}
%>
Register.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"%>
<html><head><title>회원가입</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="script.js"></script>
</head>
<body><br><br><br>
<table align=center border=0 cellpadding=5>
<tr>
<td align=center valign=middle bgcolor="#ffffcc">
<table border=1 cellpadding=2 align=center>
<form name=frm method=post action="RegisterProc.jsp">
<tr bgcolor="#efaa11">
<td colspan=2 align=center><font size=4><b>회원 가입</b></font></td>
</tr>
<tr>
<td width=20%>아이디</td>
<td><input type=text name=mem_id size=15>
<input type=button value=" id 중복 확인 "
onClick="idCheck(this.form.mem_id.value)">
</td>
</tr>
<tr>
<td>비밀번호</td>
<td><input type=text name=mem_passwd size=15></td>
</tr>
<tr>
<td>비밀번호 확인</td>
<td><input type=text name=mem_repasswd size=15></td>
</tr>
<tr>
<td>회원명</td>
<td><input type=text name=mem_name size=15></td>
</tr>
<tr>
<td>주민등록번호</td>
<td><input type=text name=mem_num1 size=6 maxlength=6
onKeyUp="if(this.value.length==6) frm.mem_num2.focus();">-
<input type=text name=mem_num2 size=7 maxlength=7
onKeyUp="if(this.value.length==7) frm.mem_email.focus();">
</td>
</tr>
<tr>
<td>이메일</td>
<td><input type=text name=mem_email size=30></td>
</tr>
<tr>
<td>전화번호</td>
<td><input type=text name=mem_phone size=30></td>
</tr>
<tr>
<td>우편번호</td>
<td><input type=text name=mem_zipcode size=7>
<input type=button value="우편번호 찾기"
onClick="zipCheck()">
</td>
</tr>
<tr>
<td>주소</td>
<td><input type=text name=mem_address size=80></td>
</tr>
<tr><td>직업선택</td>
<td> <select name=mem_job>
<option value="회사원">회사원
<option value="학생">학생
<option value="자영업">자영업
<option value="주부">주부
<option value="기타">기타
</select>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<input type=button value=확인완료
onClick="inputCheck()">&&&&
<input type=reset value=새로입력>
</td>
</tr>
</form>
</td>
</tr>
</table>
</body></html>
RegisterProc.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<jsp:useBean id="memMgr" class="pac.MemberMgr" />
<%
request.setCharacterEncoding("EUC-KR");
String mem_id = request.getParameter("mem_id");
String mem_passwd = request.getParameter("mem_passwd");
String mem_name = request.getParameter("mem_name");
String mem_num1 = request.getParameter("mem_num1");
String mem_num2 = request.getParameter("mem_num2");
String mem_email = request.getParameter("mem_email");
String mem_phone = request.getParameter("mem_phone");
String mem_zipcode = request.getParameter("mem_zipcode");
String mem_address = request.getParameter("mem_address");
String mem_job = request.getParameter("mem_job");
%>
<html><body>
<table align=center border=0 cellpadding=5>
<tr>
<td align=center valign=middle bgcolor="#ffffcc">
<table border=1 cellpadding=2 align=center>
<form name=frm method=post action="MemberInsert.jsp">
<tr bgcolor="#efaa11">
<td colspan=2 align=center><font size=4><b><%=mem_name %>님 회원 가입 확인해주세요.</b></font></td>
</tr>
<tr>
<td width=20%>아이디</td>
<td><input type=text name=mem_id readonly="readonly" size=15 value=<%=mem_id %>>
</td>
</tr>
<tr>
<td>비밀번호</td>
<td><input type=text name=mem_passwd readonly="readonly" size=15 value=<%=mem_passwd %>></td>
</tr>
<tr>
<td>회원명</td>
<td><input type=text name=mem_name size=15 readonly="readonly" value=<%=mem_name %>></td>
</tr>
<tr>
<td>주민등록번호</td>
<td><input type=text name=mem_num1 size=6 maxlength=6 readonly="readonly" value=<%=mem_num1 %>>-
<input type=text name=mem_num2 size=7 maxlength=7 readonly="readonly" value=<%=mem_num2 %>>
</td>
</tr>
<tr>
<td>이메일</td>
<td><input type=text name=mem_email size=30 readonly="readonly" value=<%=mem_email %>></td>
</tr>
<tr>
<td>전화번호</td>
<td><input type=text name=mem_phone size=30 readonly="readonly" value=<%=mem_phone %>></td>
</tr>
<tr>
<td>우편번호</td>
<td><input type=text name=mem_zipcode size=7 readonly="readonly" value=<%=mem_zipcode %>>
</td>
</tr>
<tr>
<td>주소</td>
<td><input type=text name=mem_address size=80 readonly="readonly" value=<%=mem_address %>></td>
</tr>
<tr><td>직업</td>
<td><input type=text name=mem_job size=20 readonly="readonly" value=<%=mem_job %>>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<input type=button value=확인완료 onclick=document.frm.submit()>
<input type=reset value=새로입력 onclick=history.back()>
</td>
</tr>
</form>
</td>
</tr>
</table>
</body></html>
script.js
function loginCheck(){
if(document.frm.mem_id.value==""){
alert("아이디를 입력해 주세요.");
document.frm.mem_id.focus();
return;
}
if(document.frm.mem_passwd.value==""){
alert("비밀번호를 입력해 주세요.");
document.frm.mem_passwd.focus();
return;
}
document.frm.submit();
}
function memberReg(){
document.location="Register.jsp";
}
function inputCheck(){
if(document.frm.mem_id.value==""){
alert("아이디를 입력해 주세요.");
document.frm.mem_id.focus();
return;
}
if(document.frm.mem_passwd.value==""){
alert("비밀번호를 입력해 주세요.");
document.frm.mem_passwd.focus();
return;
}
if(document.frm.mem_repasswd.value==""){
alert("비밀번호를 확인해 주세요");
document.frm.mem_repasswd.focus();
return;
}
if(document.frm.mem_passwd.value != document.frm.mem_repasswd.value){
alert("비밀번호가 일치하지 않습니다.");
document.frm.mem_repasswd.focus();
return;
}
if(document.frm.mem_name.value==""){
alert("이름을 입력해 주세요.");
document.frm.mem_name.focus();
return;
}
if(document.frm.mem_num1.value==""){
alert("주민번호을 입력해 주세요.");
document.frm.mem_num1.focus();
return;
}
if(document.frm.mem_num2.value==""){
alert("주민번호을 입력해 주세요.");
document.frm.mem_num2.focus();
return;
}
var jumin1=frm.mem_num1.value;
var jumin2=frm.mem_num2.value;
var jumin=jumin1 + jumin2;
var index="234567892345";
var total=0;
for(var i=0;i<12;i++)
total+=parseInt(jumin.charAt(i)*index.charAt(i));
total=11-total%11;
if(total==10)
total=0;
else if(total==11)
total=1;
if(total!=jumin.charAt(12))
{
alert("주민번호를 다시 확인하세요.");
document.frm.mem_num1.value="";
document.frm.mem_num2.value="";
document.frm.mem_num1.focus();
return;
}
if(document.frm.mem_email.value==""){
alert("이메일을 입력해 주세요.");
document.frm.mem_email.focus();
return;
}
var str=document.frm.mem_email.value;
var atPos = str.indexOf('@');
var atLastPos = str.lastIndexOf('@');
var dotPos = str.indexOf('.');
var spacePos = str.indexOf(' ');
var commaPos = str.indexOf(',');
var eMailSize = str.length;
if (atPos > 1 && atPos == atLastPos &&
dotPos > 3 && spacePos == -1 && commaPos == -1
&& atPos + 1 < dotPos && dotPos + 1 < eMailSize);
else {
alert('E-mail주소 형식이 잘못되었습니다.\n\r다시 입력해 주세요!');
document.frm.mem_email.focus();
return;
}
if(document.frm.mem_phone.value==""){
alert("연락처를 입력해 주세요.");
document.frm.mem_phone.focus();
return;
}
if(document.frm.mem_job.value=="0"){
alert("직업을 선택해 주세요.");
document.frm.mem_job.focus();
return;
}
document.frm.submit();
}
function idCheck(id){
if(id == ""){
alert("아이디를 입력해 주세요.");
document.frm.mem_id.focus();
}else{
url="IdCheck.jsp?mem_id=" + id;
window.open(url,"post","width=300,height=150");
}
}
function zipCheck(){
url="ZipCheck.jsp?check=y";
window.open(url,"post","toolbar=no ,width=500 ,height=300 ,directories=no,status=yes,scrollbars=yes,menubar=no");
}
function win_close(){
self.close();
}
style.css
BODY {FONT-SIZE: 9pt; COLOR: black; LINE-HEIGHT: 160%; FONT-FAMILY: 굴림 }
TD {FONT-SIZE: 9pt; COLOR: black; LINE-HEIGHT: 160%; FONT-FAMILY: 굴림 }
SELECT {FONT-SIZE: 9pt; COLOR: black; LINE-HEIGHT: 160%; FONT-FAMILY: 굴림 }
DIV {FONT-SIZE: 9pt; COLOR: black; LINE-HEIGHT: 160%; FONT-FAMILY: 굴림 }
FORM {FONT-SIZE: 9pt; COLOR: black; LINE-HEIGHT: 160%; FONT-FAMILY: 굴림 }
TEXTAREA {
BORDER-RIGHT: 1px solid #999999; BORDER-TOP: 1px solid #999999;
FONT-SIZE: 9pt; BORDER-LEFT: 1px solid #999999 ; COLOR: BLACK; BORDER-BOTTOM: 1px solid #999999;
FONT-FAMILY: 굴림,verdana; BACKGROUND-COLOR: white
}
INPUT {
BORDER-RIGHT: 1px solid #999999; BORDER-TOP: 1px solid #999999; FONT-SIZE: 9pt;
BORDER-LEFT: 1px solid #999999; COLOR: BLACK; BORDER-BOTTOM: 2px solid #999999; ;
BORDER-RIGHT: 2px solid #999999; FONT-FAMILY: 굴림,verdana; HEIGHT: 19px; BACKGROUND-COLOR: white
}
A:link {text-decoration:none;color:#696969}
A:hover{text-decoration:yes;color:#66CCFF}
A:visited {text-decoration:none;color:#330066}
ZipCheck.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
import="java.util.*,pac.*"
%>
<jsp:useBean id="memMgr" class="pac.MemberMgr" />
<%
request.setCharacterEncoding("EUC-KR");
String check=request.getParameter("check");
String area3 = request.getParameter("area3");
Vector zipList = memMgr.zipcodeRead(area3);
%>
<html><head><title>우편번호검색</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="script.js"></script>
<script>
function dongCheck(){
if(frm.area3.value == ""){
alert("동 이름을 입력하시오.");
frm.area3.focus();
return;
}
frm.submit();
}
function send(code, area1, area2, area3, area4){
var addr = area1 + " " + area2 + " " + area3 + " " + area4;
opener.document.frm.mem_zipcode.value = code;
opener.document.frm.mem_address.value = addr;
self.close();
}
</script>
</head>
<body><center><b>우편번호 찾기</b>
<form name="frm" method="post" action="ZipCheck.jsp">
<table>
<tr>
<td>동이름 입력 : <input type=text name="area3">
<input type=button value="검색"
onClick="dongCheck()">
</td>
<input type="hidden" name="check" value="n">
</form>
<%
if(check.equals("n")){
if(zipList.isEmpty()){
%>
<tr><td align=center>검색된 결과가 없습니다.</td></tr>
<%
}else{
%>
<tr><td align=center>
* 검색 후 아래 우편번호를 누르면 자동으로 입력됩니다
</td>
</tr>
<%
for(int i=0; i < zipList.size(); i++){
ZipcodeBean bean =(ZipcodeBean)zipList.elementAt(i);
%>
<tr>
<td>
<a href="javascript:send('<%=bean.getCode()%>',
'<%=bean.getArea1()%>',
'<%=bean.getArea2()%>',
'<%=bean.getArea3()%>',
'<%=bean.getArea4()%>')">
<%=bean.getCode()%>&
<%=bean.getArea1()%>&
<%=bean.getArea2()%>&
<%=bean.getArea3()%>&
<%=bean.getArea4()%>
</a>
<%
}
}
}
%>
</td>
</tr>
<tr><td align=center><br>
<a href="javascript:this.close();">닫기</a>
</td>
</tr>
</table>
</body></html>
이제 쇼핑몰 나가네요 ^_^
idCheck.jsp
LogError.jsp
Login.jsp
LoginProc.jsp
Logout.jsp
MemberInsert.jsp
register.jsp
RegisterProc.jsp
script.js
style.css
ZipCheck.jsp
idCheck.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<jsp:useBean id="memMgr" class="pac.MemberMgr"></jsp:useBean>
<%
String mem_id = request.getParameter("mem_id");
boolean chk = memMgr.checkId(mem_id);
%>
<html><head>
<link href="style.css" rel="stylesheet" type="text/css">
<title>ID 중복 검사</title>
</head>
<body bgcolor="cyan"><center><p>
<b><%=mem_id %></b>
<%
if(chk)
out.println("는 이미 존재하는 아이디 입니다.<p>");
else
out.println("는 사용 가능합니다.<p>");
%>
<a href="#" onclick="self.close()">닫기</a>
</center>
</body></html>
LogError.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"
%>
<html><head><link href="style.css" rel="stylesheet" type="text/css"></head>
<body><center>
<b>로그인에 실패하셧습니다.</b><p>
아이디와 비밀번호를 다시 확인하세요.<p>
<input type=button value="다시쓰기"
onclick="history.back">
</center></body></html>
Login.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<%
String mem_id = (String)session.getAttribute("idKey");
%>
<html><head>
<title>로그인 화면</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="script.js"></script>
</head><body><br><br><br><center>
<%
if(mem_id != null) {
%>
<b>등록된 회원으로 제한된 기능을 보여줍니다.</b><p>
<a href="Logout.jsp">로그아웃</a>
<%
} else {
%>
<form name="frm" method=post action="LoginProc.jsp">
<table><tr><td align=center colspan=2><h3>로그인</h3></td></tr>
<tr><td>아이디</td><td><input type=text name=mem_id></td></tr>
<tr><td>비밀번호</td><td><input type=passwd name=mem_passwd></td></tr>
<tr><td colspan=2>
<input type=button value="로그인" onclick="loginCheck()">&
<input type=button value="회원가입" onclick="memberReg()">&
</td>
</tr></table></form>
<% } %>
</center>
</body>
</html>
LoginProc.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<jsp:useBean id="memMgr" class="pac.MemberMgr"></jsp:useBean>
<%
String mem_id = request.getParameter("mem_id");
String mem_passwd = request.getParameter("mem_passwd");
boolean b = memMgr.loginCheck(mem_id, mem_passwd);
if(b) {
session.setAttribute("idKey", mem_id);
response.sendRedirect("Login.jsp");
}else
response.sendRedirect("LogError.jsp");
%>
Logout.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<%
// session.removeAttribute("idKey");
session.invalidate();
%>
<script>
alert("로그아웃 되었습니다.");
location.href("Login.jsp");
</script>
MemberInsert.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR" %>
<% request.setCharacterEncoding("EUC-KR"); %>
<jsp:useBean id="data" class="pac.MemberBean" />
<jsp:setProperty property="*" name="data" />
<jsp:useBean id="mgr" class="pac.MemberMgr" />
<%
if(mgr.saveData(data)) {
out.println("회원 가입 성공!!!");
out.println("<a href=Login.jsp>로그인</a>");
}else {
out.println("가입 실패! 다시 해보세요. 아님 관리자!");
out.println("<a href=Register.jsp>다시 가입</a>");
}
%>
Register.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"%>
<html><head><title>회원가입</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="script.js"></script>
</head>
<body><br><br><br>
<table align=center border=0 cellpadding=5>
<tr>
<td align=center valign=middle bgcolor="#ffffcc">
<table border=1 cellpadding=2 align=center>
<form name=frm method=post action="RegisterProc.jsp">
<tr bgcolor="#efaa11">
<td colspan=2 align=center><font size=4><b>회원 가입</b></font></td>
</tr>
<tr>
<td width=20%>아이디</td>
<td><input type=text name=mem_id size=15>
<input type=button value=" id 중복 확인 "
onClick="idCheck(this.form.mem_id.value)">
</td>
</tr>
<tr>
<td>비밀번호</td>
<td><input type=text name=mem_passwd size=15></td>
</tr>
<tr>
<td>비밀번호 확인</td>
<td><input type=text name=mem_repasswd size=15></td>
</tr>
<tr>
<td>회원명</td>
<td><input type=text name=mem_name size=15></td>
</tr>
<tr>
<td>주민등록번호</td>
<td><input type=text name=mem_num1 size=6 maxlength=6
onKeyUp="if(this.value.length==6) frm.mem_num2.focus();">-
<input type=text name=mem_num2 size=7 maxlength=7
onKeyUp="if(this.value.length==7) frm.mem_email.focus();">
</td>
</tr>
<tr>
<td>이메일</td>
<td><input type=text name=mem_email size=30></td>
</tr>
<tr>
<td>전화번호</td>
<td><input type=text name=mem_phone size=30></td>
</tr>
<tr>
<td>우편번호</td>
<td><input type=text name=mem_zipcode size=7>
<input type=button value="우편번호 찾기"
onClick="zipCheck()">
</td>
</tr>
<tr>
<td>주소</td>
<td><input type=text name=mem_address size=80></td>
</tr>
<tr><td>직업선택</td>
<td> <select name=mem_job>
<option value="회사원">회사원
<option value="학생">학생
<option value="자영업">자영업
<option value="주부">주부
<option value="기타">기타
</select>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<input type=button value=확인완료
onClick="inputCheck()">&&&&
<input type=reset value=새로입력>
</td>
</tr>
</form>
</td>
</tr>
</table>
</body></html>
RegisterProc.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<jsp:useBean id="memMgr" class="pac.MemberMgr" />
<%
request.setCharacterEncoding("EUC-KR");
String mem_id = request.getParameter("mem_id");
String mem_passwd = request.getParameter("mem_passwd");
String mem_name = request.getParameter("mem_name");
String mem_num1 = request.getParameter("mem_num1");
String mem_num2 = request.getParameter("mem_num2");
String mem_email = request.getParameter("mem_email");
String mem_phone = request.getParameter("mem_phone");
String mem_zipcode = request.getParameter("mem_zipcode");
String mem_address = request.getParameter("mem_address");
String mem_job = request.getParameter("mem_job");
%>
<html><body>
<table align=center border=0 cellpadding=5>
<tr>
<td align=center valign=middle bgcolor="#ffffcc">
<table border=1 cellpadding=2 align=center>
<form name=frm method=post action="MemberInsert.jsp">
<tr bgcolor="#efaa11">
<td colspan=2 align=center><font size=4><b><%=mem_name %>님 회원 가입 확인해주세요.</b></font></td>
</tr>
<tr>
<td width=20%>아이디</td>
<td><input type=text name=mem_id readonly="readonly" size=15 value=<%=mem_id %>>
</td>
</tr>
<tr>
<td>비밀번호</td>
<td><input type=text name=mem_passwd readonly="readonly" size=15 value=<%=mem_passwd %>></td>
</tr>
<tr>
<td>회원명</td>
<td><input type=text name=mem_name size=15 readonly="readonly" value=<%=mem_name %>></td>
</tr>
<tr>
<td>주민등록번호</td>
<td><input type=text name=mem_num1 size=6 maxlength=6 readonly="readonly" value=<%=mem_num1 %>>-
<input type=text name=mem_num2 size=7 maxlength=7 readonly="readonly" value=<%=mem_num2 %>>
</td>
</tr>
<tr>
<td>이메일</td>
<td><input type=text name=mem_email size=30 readonly="readonly" value=<%=mem_email %>></td>
</tr>
<tr>
<td>전화번호</td>
<td><input type=text name=mem_phone size=30 readonly="readonly" value=<%=mem_phone %>></td>
</tr>
<tr>
<td>우편번호</td>
<td><input type=text name=mem_zipcode size=7 readonly="readonly" value=<%=mem_zipcode %>>
</td>
</tr>
<tr>
<td>주소</td>
<td><input type=text name=mem_address size=80 readonly="readonly" value=<%=mem_address %>></td>
</tr>
<tr><td>직업</td>
<td><input type=text name=mem_job size=20 readonly="readonly" value=<%=mem_job %>>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<input type=button value=확인완료 onclick=document.frm.submit()>
<input type=reset value=새로입력 onclick=history.back()>
</td>
</tr>
</form>
</td>
</tr>
</table>
</body></html>
script.js
function loginCheck(){
if(document.frm.mem_id.value==""){
alert("아이디를 입력해 주세요.");
document.frm.mem_id.focus();
return;
}
if(document.frm.mem_passwd.value==""){
alert("비밀번호를 입력해 주세요.");
document.frm.mem_passwd.focus();
return;
}
document.frm.submit();
}
function memberReg(){
document.location="Register.jsp";
}
function inputCheck(){
if(document.frm.mem_id.value==""){
alert("아이디를 입력해 주세요.");
document.frm.mem_id.focus();
return;
}
if(document.frm.mem_passwd.value==""){
alert("비밀번호를 입력해 주세요.");
document.frm.mem_passwd.focus();
return;
}
if(document.frm.mem_repasswd.value==""){
alert("비밀번호를 확인해 주세요");
document.frm.mem_repasswd.focus();
return;
}
if(document.frm.mem_passwd.value != document.frm.mem_repasswd.value){
alert("비밀번호가 일치하지 않습니다.");
document.frm.mem_repasswd.focus();
return;
}
if(document.frm.mem_name.value==""){
alert("이름을 입력해 주세요.");
document.frm.mem_name.focus();
return;
}
if(document.frm.mem_num1.value==""){
alert("주민번호을 입력해 주세요.");
document.frm.mem_num1.focus();
return;
}
if(document.frm.mem_num2.value==""){
alert("주민번호을 입력해 주세요.");
document.frm.mem_num2.focus();
return;
}
var jumin1=frm.mem_num1.value;
var jumin2=frm.mem_num2.value;
var jumin=jumin1 + jumin2;
var index="234567892345";
var total=0;
for(var i=0;i<12;i++)
total+=parseInt(jumin.charAt(i)*index.charAt(i));
total=11-total%11;
if(total==10)
total=0;
else if(total==11)
total=1;
if(total!=jumin.charAt(12))
{
alert("주민번호를 다시 확인하세요.");
document.frm.mem_num1.value="";
document.frm.mem_num2.value="";
document.frm.mem_num1.focus();
return;
}
if(document.frm.mem_email.value==""){
alert("이메일을 입력해 주세요.");
document.frm.mem_email.focus();
return;
}
var str=document.frm.mem_email.value;
var atPos = str.indexOf('@');
var atLastPos = str.lastIndexOf('@');
var dotPos = str.indexOf('.');
var spacePos = str.indexOf(' ');
var commaPos = str.indexOf(',');
var eMailSize = str.length;
if (atPos > 1 && atPos == atLastPos &&
dotPos > 3 && spacePos == -1 && commaPos == -1
&& atPos + 1 < dotPos && dotPos + 1 < eMailSize);
else {
alert('E-mail주소 형식이 잘못되었습니다.\n\r다시 입력해 주세요!');
document.frm.mem_email.focus();
return;
}
if(document.frm.mem_phone.value==""){
alert("연락처를 입력해 주세요.");
document.frm.mem_phone.focus();
return;
}
if(document.frm.mem_job.value=="0"){
alert("직업을 선택해 주세요.");
document.frm.mem_job.focus();
return;
}
document.frm.submit();
}
function idCheck(id){
if(id == ""){
alert("아이디를 입력해 주세요.");
document.frm.mem_id.focus();
}else{
url="IdCheck.jsp?mem_id=" + id;
window.open(url,"post","width=300,height=150");
}
}
function zipCheck(){
url="ZipCheck.jsp?check=y";
window.open(url,"post","toolbar=no ,width=500 ,height=300 ,directories=no,status=yes,scrollbars=yes,menubar=no");
}
function win_close(){
self.close();
}
style.css
BODY {FONT-SIZE: 9pt; COLOR: black; LINE-HEIGHT: 160%; FONT-FAMILY: 굴림 }
TD {FONT-SIZE: 9pt; COLOR: black; LINE-HEIGHT: 160%; FONT-FAMILY: 굴림 }
SELECT {FONT-SIZE: 9pt; COLOR: black; LINE-HEIGHT: 160%; FONT-FAMILY: 굴림 }
DIV {FONT-SIZE: 9pt; COLOR: black; LINE-HEIGHT: 160%; FONT-FAMILY: 굴림 }
FORM {FONT-SIZE: 9pt; COLOR: black; LINE-HEIGHT: 160%; FONT-FAMILY: 굴림 }
TEXTAREA {
BORDER-RIGHT: 1px solid #999999; BORDER-TOP: 1px solid #999999;
FONT-SIZE: 9pt; BORDER-LEFT: 1px solid #999999 ; COLOR: BLACK; BORDER-BOTTOM: 1px solid #999999;
FONT-FAMILY: 굴림,verdana; BACKGROUND-COLOR: white
}
INPUT {
BORDER-RIGHT: 1px solid #999999; BORDER-TOP: 1px solid #999999; FONT-SIZE: 9pt;
BORDER-LEFT: 1px solid #999999; COLOR: BLACK; BORDER-BOTTOM: 2px solid #999999; ;
BORDER-RIGHT: 2px solid #999999; FONT-FAMILY: 굴림,verdana; HEIGHT: 19px; BACKGROUND-COLOR: white
}
A:link {text-decoration:none;color:#696969}
A:hover{text-decoration:yes;color:#66CCFF}
A:visited {text-decoration:none;color:#330066}
ZipCheck.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
import="java.util.*,pac.*"
%>
<jsp:useBean id="memMgr" class="pac.MemberMgr" />
<%
request.setCharacterEncoding("EUC-KR");
String check=request.getParameter("check");
String area3 = request.getParameter("area3");
Vector zipList = memMgr.zipcodeRead(area3);
%>
<html><head><title>우편번호검색</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="script.js"></script>
<script>
function dongCheck(){
if(frm.area3.value == ""){
alert("동 이름을 입력하시오.");
frm.area3.focus();
return;
}
frm.submit();
}
function send(code, area1, area2, area3, area4){
var addr = area1 + " " + area2 + " " + area3 + " " + area4;
opener.document.frm.mem_zipcode.value = code;
opener.document.frm.mem_address.value = addr;
self.close();
}
</script>
</head>
<body><center><b>우편번호 찾기</b>
<form name="frm" method="post" action="ZipCheck.jsp">
<table>
<tr>
<td>동이름 입력 : <input type=text name="area3">
<input type=button value="검색"
onClick="dongCheck()">
</td>
<input type="hidden" name="check" value="n">
</form>
<%
if(check.equals("n")){
if(zipList.isEmpty()){
%>
<tr><td align=center>검색된 결과가 없습니다.</td></tr>
<%
}else{
%>
<tr><td align=center>
* 검색 후 아래 우편번호를 누르면 자동으로 입력됩니다
</td>
</tr>
<%
for(int i=0; i < zipList.size(); i++){
ZipcodeBean bean =(ZipcodeBean)zipList.elementAt(i);
%>
<tr>
<td>
<a href="javascript:send('<%=bean.getCode()%>',
'<%=bean.getArea1()%>',
'<%=bean.getArea2()%>',
'<%=bean.getArea3()%>',
'<%=bean.getArea4()%>')">
<%=bean.getCode()%>&
<%=bean.getArea1()%>&
<%=bean.getArea2()%>&
<%=bean.getArea3()%>&
<%=bean.getArea4()%>
</a>
<%
}
}
}
%>
</td>
</tr>
<tr><td align=center><br>
<a href="javascript:this.close();">닫기</a>
</td>
</tr>
</table>
</body></html>
이제 쇼핑몰 나가네요 ^_^