IT/Java Spring

ch10.SpringMVC 종합 02.

Millennials 2020. 6. 23. 14:51

1)table 생성

/*회원관리*/
create table spmember(
	mem_num number not null,
	id varchar2(12) unique not null,
	auth number(1) default 2 not null,/*0탈퇴회원,1정지회원,2일반회원,3관리자*/
	constraint spmember_pk primary key (mem_num)
);
create table spmember_detail(
	mem_num number not null,
	name varchar2(30) not null,
	passwd varchar2(35) not null,
	phone varchar2(15) not null,
	email varchar2(50) not null,
	zipcode varchar2(5) not null,
	address1 varchar2(90) not null,
	address2 varchar2(90) not null,
	reg_date date default sysdate not null,
	modify_date date default sysdate not null,
	constraint spmember_detail_pk primary key (mem_num),
	constraint spmember_detail_fk foreign key (mem_num) references spmember (mem_num)
);

2)pom.xml

라이브러리 추가

3)MemberVO

getters and setters 추가

추가
@추가 유효성 체크

비밀번호 인증 메서드 추가

4)Controller

5)member.xml

6)memberRegister.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<div class="page-main-style">
	<h2>회원가입</h2>
	<form:form action="register.do" commandName="memberVO">
		<ul>
			<li>
				<label for="id">아이디</label>
				<form:input path="id"/>
				<img src="${pageContext.request.contextPath}/resources/images/ajax-loader.gif"
				width="16" height="16" style="display:none">
				<span id="message_id"></span>
				<form:errors path="id" cssClass="error-color"/>
			</li>
			<li>
				<label for="name">이름</label>
				<form:input path="name"/><form:errors path="name" cssClass="error-color"/>
			</li>
			<li>
				<label for="passwd">비밀번호</label>
				<form:password path="passwd"/><form:errors path="passwd" cssClass="error-color"/>
			</li>
			<li>
				<label for="phone">전화번호</label>
				<form:input path="phone"/><form:errors path="phone" cssClass="error-color"/>
			</li>
			<li>
				<label for="email">이메일</label>
				<form:input path="eamil"/><form:errors path="email" cssClass="error-color"/>
			</li>
			<li>
				<label for="zipcode">우편번호</label>
				<form:input path="zipcode"/><form:errors path="zipcode" cssClass="error-color"/>
			</li>
			<li>
				<label for="address1">주소</label>
				<form:input path="address1"/><form:errors path="address1" cssClass="error-color"/>
			</li>
			<li>
				<label for="address2">상세주소</label>
				<form:input path="address2"/><form:errors path="address2" cssClass="error-color"/>
			</li>
		</ul>
        <div class="align-center">
			<input type="submit" value="등록">
			<input type="button" value="홈으로" onclick="location.href='${pageContext.request.contextPath }/main/main.do'">
		</div>
	</form:form>
</div>

7)servlet-context.xml

member.xml 설정에 추가

8)호출테스트

반응형