main.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"pageEncoding="EUC-KR"%>
<html>
<head>
<title>게시판 메인</title>
<% try{ if(session.getAttribute("memId")==null){%>
</head>
<body onLoad="focusIt();">
<h1>로그인 이전 메인 페이지</h1>
<h2>main.jsp</h2>
<table border="1" width="1000" cellpadding="2" cellspacing="0" align="center">
<tr>
<td colspan="3">
<jsp:include page="include/top.jsp"></jsp:include>
</td>
</tr>
<tr>
<td width="160">
<jsp:include page="include/left_logoff.jsp"></jsp:include>
</td>
<td>
<jsp:include page="include/center.jsp"></jsp:include>
</td>
<td width="150">
<jsp:include page="include/right.jsp"></jsp:include>
</td>
</tr>
<tr>
<td colspan="3">
<jsp:include page="include/bottom.jsp"></jsp:include>
</td>
</tr>
</table>
<% } else { %>
<h1>로그인 이후 메인 페이지</h1>
<h2>main.jsp</h2>
<table border="1" width="1000" cellpadding="2" cellspacing="0" align="center">
<tr>
<td colspan="3">
<jsp:include page="include/top.jsp"></jsp:include>
</td>
</tr>
<tr>
<td width="150">
<jsp:include page="include/left_logon.jsp"></jsp:include>
</td>
<td>
<jsp:include page="include/center.jsp"></jsp:include>
</td>
<td width="150">
<jsp:include page="include/right.jsp"></jsp:include>
</td>
</tr>
<tr>
<td colspan="3">
<jsp:include page="include/bottom.jsp"></jsp:include>
</td>
</tr>
</table>
<% }} catch(Exception e){} %>
</body>
<script language="javascript">
<!--
function focusIt()
{
document.loginTemplate.id.focus();
}
function checkIt()
{
inputForm=eval("document.inputform");
if(!inputForm.id.value){
alert("아이디를 입력하세요.");
return false;
}
if(!inputForm.pw.value){
alert("비밀번호를 입력하세요.");
return false;
}
}
-->
</script>
</html>
left_logoff.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
</head>
<body>
<h1>left include</h1>
<h2>left_logoff.jsp</h2>
<form name="inputform" method="post" action="loginCheck.jsp" onSubmit="return checkIt();">
<h4>아이디 :</h4>
<input type="text" name="id" /> <br />
<h4>비밀번호 :</h4>
<input type="password" name="pw" /> <br /><br />
<input type="submit" value="로그인" />
<input type="button" value="회원가입" onclick="javascript:window.location='insertForm.jsp'">
</form>
</body>
</html>
left_logon.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
</head>
<body>
<h1>left include</h1>
<h2>left_logon.jsp</h2>
<h4> <%= session.getAttribute("memId") %>님 반갑습니다. </h4> <br />
<input type="button" value="로그아웃" onClick="window.location='logout.jsp'">
<input type="button" value="회원정보변경" onclick="javascript:window.location='modify.jsp'">
</body>
</html>
insertForm.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>회원가입</title>
</head>
<body onload="begin()">
<H1>회원가입 페이지</H1>
<H2>joinForm.jsp</H2>
<div>
<form name="joinform" action="insertMember.jsp" method="post" onSubmit="return checkIt()">
<table border="1">
<tr>
<td colspan="2" bgcolor="#fffacd" height="25">계정정보 입력</td>
</tr>
<tr>
<td height="30">사용자 ID</td>
<td width="450">
<input type="text" name="id" size="15" maxlength="12">
<input type="button" name="comfirmId" value="중복확인" onClick="openConfirmId(this.form)">
</td>
</tr>
<tr>
<td height="30">비밀번호</td>
<td>
<input type="password" name="pw" size="15" maxlength="12"></input>
</td>
</tr>
<tr>
<td height="30">비밀번호 확인</td>
<td>
<input type="password" name="pw2" size="15" maxlength="12"></input>
</td>
</tr>
<tr>
<td colspan="2" bgcolor="#fffacd" height="25">개인정보 입력</td>
</tr>
<tr>
<td height="30">이름</td>
<td>
<input type="text" name="name" size="15" maxlength="12"></input>
</td>
</tr>
<tr>
<td height="30">생일</td>
<td>
<select name="month">
<option>선택</option>
<option>1월</option>
<option>2월</option>
<option>3월</option>
<option>4월</option>
<option>5월</option>
<option>6월</option>
<option>7월</option>
<option>8월</option>
<option>9월</option>
<option>10월</option>
<option>11월</option>
<option>12월</option>
</select>
<select name="day">
<option>선택</option>
<option>1일</option>
<option>2일</option>
<option>3일</option>
<option>4일</option>
<option>5일</option>
<option>6일</option>
<option>7일</option>
<option>8일</option>
<option>9일</option>
<option>10일</option>
<option>11일</option>
<option>12일</option>
<option>13일</option>
<option>14일</option>
<option>15일</option>
<option>16일</option>
<option>17일</option>
<option>18일</option>
<option>19일</option>
<option>20일</option>
<option>21일</option>
<option>22일</option>
<option>23일</option>
<option>24일</option>
<option>25일</option>
<option>26일</option>
<option>27일</option>
<option>28일</option>
<option>29일</option>
<option>30일</option>
<option>31일</option>
</select>
</td>
</tr>
<tr>
<td height="30">성별</td>
<td>
<input type="radio" name="sex" value="male"/> 남성
<input type="radio" name="sex" value="female"/> 여성
<input type="radio" name="sex" value="etc"/> 기타
</td>
</tr>
<tr>
<td height="30">전화번호</td>
<td>
<input type="text" name="tel" size="20" maxlength="30"></input>
</td>
</tr>
<tr>
<td height="30">E-Mail</td>
<td>
<input type="text" name="email"size="20" maxlength="30"></input>
</td>
</tr>
</table>
<input type="submit" value="가입">
<input type="reset" name="reset" value="초기화">
<input type="button" name="cancel" value="가입안함" onclick="javascript:window.location='main.jsp'">
</form>
</div>
</body>
<script language="javascript">
<!--
function begin(){
document.joinform.id.focus();
}
function checkIt(){
if(!document.joinform.id.value){
alert("joinform : 아이디를 입력하지 않으셨습니다.");
return false;
}
if(document.joinform.pw.value != document.joinform.pw2.value || document.joinform.pw.value=="" || document.joinform.pw2.value=="" ){
alert("joinform : 비밀번호를 동일하게 입력하세요.");
return false;
}
if(!document.joinform.name.value){
alert("joinform : 이름을 입력하지 않으셨습니다.");
return false;
}
if(!document.joinform.tel.value){
alert("joinform : 전화번호를 입력하지 않으셨습니다.");
return false;
}
if(!document.joinform.email.value){
alert("joinform : 이메일을 입력하지 않으셨습니다.");
return false;
}
}
var nowpage = "document.joinform";
function openConfirmId(nowpage) {
if (document.joinform.id.value == "") {
alert("openConfirmId : 아이디를 입력하세요");
return;
}
url = "confirmId.jsp?id=" + document.joinform.id.value ;
open(url, "confirm","toolbar=no, location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500, height=400");
}
-->
</script>
</html>
insertMember.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<%@ page import="bean.MemberDAO" %>
<%@ page import = "java.sql.Timestamp" %>
<html>
<head>
<title>가입완료</title>
</head>
<body>
<H1>member insert 페이지</H1>
<h2>insertMember.jsp</h2>
<% request.setCharacterEncoding("euc-kr");%>
<jsp:useBean id="dto" class="bean.MemberDTO" />
<jsp:setProperty property="*" name="dto"/>
<%
MemberDAO dao = MemberDAO.getInstance();
dao.insert(dto);
response.sendRedirect("loginForm.jsp");
%>
</body>
</html>
confirmId.jsp
<%@ page contentType="text/html;charset=euc-kr" %><%@ page import = "bean.MemberDAO" %>
<html>
<head>
<title>ID 중복확인</title>
<% request.setCharacterEncoding("euc-kr");%>
<%
String id = request.getParameter("id");
MemberDAO dao = MemberDAO.getInstance();
boolean check = dao.confirmId(id);
%>
</head>
<body>
<H1>ID 중복확인 페이지</H1>
<H2>confirmId.jsp</H2>
<%
if(check == true) {
%>
<table border="1" width="270" cellspacing="0" cellpadding="5">
<tr >
<td><%=id%></td>
<td>이미 사용중인 아이디입니다.</td>
</tr>
</table>
<form name="checkForm" method="post" action="confirmId.jsp">
<table border="1" width="300" cellspacing="0" cellpadding="5">
<tr>
<td align="center"> 다른 아이디를 선택하세요.<p>
<input type="text" name="id" size="10" maxlength="12">
<input type="submit" value="ID중복확인">
</td>
</tr>
</table>
</form>
<%
} else {
%>
<table border="1" width="300" cellspacing="0" cellpadding="5">
<tr>
<td align="center">
<p><%=id%></p>
</td>
<td align="center">
<p>사용 가능한 ID입니다.</p>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="button" value="닫기" onclick="setid()">
</td>
</tr>
</table>
<%
}
%>
</body>
<script language="JavaScript">
<!--
function setid()
{
opener.document.joinform.id.value="<%=id%>";
self.close();
}
-->
</script>
</html>