memberform.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> Member Regist </title>
<script type="text/javascript">
function chkid(){
window.open("CheckId.jsp?userId="+document.frm.id.value);
}
</script>
</head>
<body>
<div data-role="content">
<h1>회원가입서 작성하기</h1>
<form action="InsertMember.jsp" method="post" name="frm">
<table>
<tr>
<td width="100">
<font color="blue">아이디</font>
</td>
<td width="100">
<input type="text" name="id">
<input type="button" value="중복확인" onclick="JavaScript:chkid()"><br/>
</td>
</tr>
<tr>
<td width="100">
<font color="blue">비밀번호</font>
</td>
<td width="100">
<input type="password" name="password"/><br/>
</td>
</tr>
<tr>
<td width="100">
<font color="blue">비밀번호학인</font>
</td>
<td width="100">
<input type="password" name="repassword"/><br/>
</td>
</tr>
<tr>
<td width="100">
<font color="blue">이름</font>
</td>
<td width="100">
<input type="text" name="name"/><br/>
</td>
</tr>
<tr>
<td width="100">
<font color="blue">전화번호</font>
</td>
<td>
<input type="text" size="15" name="tel"/>
<br/>
</td>
</tr>
<tr>
<td width="100">
<font color="blue">주소</font>
</td>
<td>
<input type="text" size="50" name="addr"/><br/>
</td>
</tr>
<tr>
<td width="100">
<!--로그인 버튼-->
<input type="submit" value="회원가입">
</td>
<td width="100">
<input type="reset" name="cancel" value="취소"><br/>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
insertmemver.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<% request.setCharacterEncoding("euc-kr"); %>
<!-- 전화면의 입력값을 member빈즈로 넘겨주세요 -->
<%@ page import = "member.beans.Member" %>
<%@ page import = "member.beans.MemberDao" %>
<!-- 객체생성 -->
<jsp:useBean id="bean" class="member.beans.Member">
<%--
이걸
<jsp:setProperty name="bean" property="name"/>
<!-- String name = request.getParameter("name");
bean.setName(name);
이거 두개에 해당하는게 한줄로 끝. 하지만 이름이 전부다 맞아야 된다는 점.. -->
<jsp:setProperty name="bean" property="id"/>
아래처럼
--%>
<jsp:setProperty name="bean" property="*"/>
</jsp:useBean>
<!-- 빈즈를 dao으로 넘김 -->
<%
//MemberDao dao = new MemberDao();
MemberDao dao = MemberDao.getInstance();
dao.insertMember(bean);
%>
<!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=EUC-KR">
<title>Insert title here</title>
</head>
<body>
아이디 : <!--<jsp:getProperty name="bean" property="id"/>이건 기니까 아래처럼 해도됨-->
<%=bean.getId() %><br>
패스워드 :<jsp:getProperty name="bean" property="password"/><br>
이름 :<jsp:getProperty name="bean" property="name"/> <br>
전화 : <jsp:getProperty name="bean" property="tel"/><br>
주소 : <jsp:getProperty name="bean" property="addr"/><br>
</body>
</html>
checkid.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<%@ page import="member.beans.*" %>
<%
String id = request.getParameter("userId");
MemberDao memDao = MemberDao.getInstance();
%>
<!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=EUC-KR">
<title> 아이디 중복 체크 </title>
</head>
<body>
<%
if( memDao.isDuplicatedId(id)) {
%>
사용중인 아이디가 있습니다. 다시 입력하여 주십시오.
<% }else { %>
사용할 수 있는 아이디입니다.
<% } %>
</body>
</html>
member.java
package member.beans;
public class Member {
private String id;
private String password;
private String name;
private String tel;
private String addr;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public String getAddr() {
return addr;
}
public void setAddr(String addr) {
this.addr = addr;
}
}
'it > JSP' 카테고리의 다른 글
게시판게시판해. jsp board.bean (0) | 2014.08.27 |
---|---|
게시판. bean, javascript 이용 게시판 갯수 등등작업 완료 (0) | 2014.08.26 |
팝업창 (0) | 2014.08.25 |
쇼핑몰 기초 (0) | 2014.08.25 |
크롬 캐시 폴더 확인. (0) | 2014.08.25 |