member_servlet_fc
register_form.jsp
login_form.jsp
search_form.jsp
modify_form.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function registerCheck(){
var id = document.register_form.id;
var pwd = document.register_form.password;
var name = document.register_form.name;
var registerNumber1 = document.register_form.registerNumber1;
var registerNumber2 = document.register_form.registerNumber2;
if(id.value==""){
alert("아이디를 입력해 주세요.");
id.focus();
return false;
}
if(pwd.value==""){
alert("비밀번호를 입력해 주세요.");
pwd.focus();
return false;
}
if(name.value==""){
alert("이름을 입력해 주세요.");
name.focus();
return false;
}
if(registerNumber1.value==""){
alert("주민번호를 입력해 주세요.");
registerNumber1.focus();
return false;
}
if(registerNumber1.value.length!=6){
alert("주민번호 앞자리 6자리를 입력해 주세요.");
registerNumber1.focus();
return false;
}
if(registerNumber2.value==""){
alert("주민번호를 입력해 주세요.");
registerNumber2.focus();
return false;
}
if(registerNumber2.value.length!=7){
alert("주민번호 뒷자리 7자리를 입력해 주세요.");
registerNumber1.focus();
return false;
}
}
</script>
</head>
<body>
<jsp:include page="/menu.jsp"/>
<form action="/${initParam.context_root }/forward.jsp" method="post" name="register_form" onsubmit="return registerCheck()">
<input type="hidden" name="command" value="register_member">
<table border="1">
<tr>
<td align="center">id</td><td><input type="text" name="id" maxlength="10" size="10"></td>
</tr>
<tr>
<td align="center">pwd</td><td><input type="password" name="password" maxlength="4" size="4"></td>
</tr>
<tr>
<td align="center">이름 : </td><td><input type="text" name="name" maxlength="10" size="10"></td>
</tr>
<tr>
<td align="center">주민번호 : </td>
<td>
<input type="text" name="registerNumber1" maxlength="6" size="6">-
<input type="text" name="registerNumber2" maxlength="7" size="7">
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="가입">
<input type="reset" value="다시작성"></td>
</tr>
</table>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:if test="${sessionScope.memberDTO != null }">
<jsp:forward page="/res/member_details.jsp"/>
</c:if>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function loginCheck(){
var id = document.login_form.id;
var pwd = document.login_form.password;
if(id.value==""){
alert("아이디를 입력해 주세요.");
id.focus();
return false;
}
if(pwd.value==""){
alert("비밀번호를 입력해 주세요.");
pwd.focus();
return false;
}
}
</script>
</head>
<c:if test="${requestScope.error_message!=null }">
<font color="red">${requestScope.error_message }</font>
</c:if><br>
<body>
<jsp:include page="/menu.jsp"/>
<form action="/${initParam.context_root }/controller" method="post" name="login_form" onsubmit="return loginCheck()">
<input type="hidden" name="command" value="login">
<table>
<tr>
<td><h2>로그인</h2><p></td>
</tr>
<tr>
<td>id</td><td><input type="text" name="id"></td>
</tr>
<tr>
<td>password</td><td><input type="password" name="password"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="로그인"><input type="reset" value="초기화"></td>
</tr>
</table>
</form>
</body>
</html>
<%@page import="member.dto.MemberDTO"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function modifyCheck(){
var pwd = document.modify_form.password;
var name = document.modify_form.name;
var registerNumber1 = document.modify_form.registerNumber1;
var registerNumber2 = document.modify_form.registerNumber2;
if(pwd.value==""){
alert("비밀번호를 입력해 주세요.");
pwd.focus();
return false;
}
if(name.value==""){
alert("이름을 입력해 주세요.");
name.focus();
return false;
}
if(registerNumber1.value==""){
alert("주민번호를 입력해 주세요.");
registerNumber1.focus();
return false;
}
if(registerNumber2.value==""){
alert("주민번호를 입력해 주세요.");
registerNumber2.focus();
return false;
}
if(registerNumber1.value.length!=6){
alert("주민번호 앞자리 6자리를 입력해 주세요.");
registerNumber1.focus();
return false;
}
if(registerNumber2.value.length!=7){
alert("주민번호 뒷자리 7자리를 입력해 주세요.");
registerNumber1.focus();
return false;
}
}
</script>
</head>
<body>
<jsp:include page="/menu.jsp"/>
<h2>회원정보수정</h2><hr><p>
<form action="/${initParam.context_root }/forward.jsp" method="post" name="modify_form" onsubmit="return modifyCheck()">
<input type="hidden" name="command" value="member_modify">
<input type="hidden" name="id" value="${sessionScope.memberDTO.id }">
<table width="500">
<tr>
<td>아이디</td><td>${sessionScope.memberDTO.id }</td>
</tr>
<tr>
<td>비밀번호</td><td><input type="text" name="password"></td>
</tr>
<tr>
<td>이름</td><td><input type="text" name="name" value="${sessionScope.memberDTO.name }"></td>
</tr>
<tr>
<td>주민번호</td><td><input type="text" name="registerNumber1" value="${sessionScope.memberDTO.registerNumber1 }">-<input type="text" name="registerNumber2" value="${sessionScope.memberDTO.registerNumber2 }"></td>
</tr>
<tr>
<td>마일리지 ${sessionScope.memberDTO.mileage }</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="정보수정"><input type="reset" value="다시작성"></td>
</tr>
</table>
</form>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function mileageSearchFormCheck(){
var startMileage = document.mileage_search_form.startMileage;
var endMileage = document.mileage_search_form.endMileage;
if(startMileage.value==""){
alert("시작 마일리지를 입력해 주세요.");
startMileage.focus();
return false;
}
if(endMileage.value==""){
alert("끝마일리지를 입력해 주세요.");
endMileage.focus();
return false;
}
if(parseInt(startMileage.value)>parseInt(endMileage.value)){
alert("시작마일리지가 끝마일리지보다 작아야 합니다. 다시 입력해 주세요.");
startMileage.focus();
return false;
}
if(isNaN(startMileage.value)||isNaN(endMileage.value)){
alert("마일리지는 숫자를 입력하십시오.");
return false;
}
}
function nameSearchFormCheck(){
var name = document.name_search_form.name;
if(name.value==""){
alert("이름를 입력해 주세요.");
name.focus();
return false;
}
}
</script>
</head>
<body>
<font size="2" color="red">${requestScope.error_message }</font><br>
마일리지 검색하기<hr><p>
<form action="/${initParam.context_root }/controller?command=member_search" method="post" name="mileage_search_form" onsubmit="return mileageSearchFormCheck()">
범위 : <input type = "text" name="startMileage">~<input type = "text" name="endMileage">
<input type="submit" value="검색">
</form>
<br>
<form action="/${initParam.context_root }/controller" method="post" name="name_search_form" onsubmit="return nameSearchFormCheck()"><!-- 만약에버튼으로 만들었을 때는 onclick으로 해놓고 함수에서 form.submit()을 해줘야한다. -->
이름 : <input type="text" name="name">
<input type="submit" value="이름으로 검색">
<input type="hidden" name="command" value="searchMemberByName">
</form>
</body>
</html>
* 결과보기
register_form.jsp
'프로그래밍 > JavaScript' 카테고리의 다른 글
2012-5-24 DOM 다루기 - 노드접근(단거리 접근) (0) | 2012.05.24 |
---|---|
2012-5-24 DOM 다루기 - 노드접근(태그,id로 접근) (0) | 2012.05.24 |
2012-5-23 text객체와 textarea객체 정의 (1) | 2012.05.23 |
2012-5-23 select태그 정의[실습] (0) | 2012.05.23 |
2012-5-23 라디오버튼 테스트[성별 체크여부 실습] (0) | 2012.05.23 |