membershipForm.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><title>회원가입 입력 폼</title></head>
<body>

<form action="<%= request.getContextPath() %>/processJoining.jsp" 
                                              method="post">

<table border="1" cellpadding="0" cellspacing="0">
<tr>
	<td>아이디</td>
	<td><input type="text" name="id" size="10"></td>
	<td>비밀번호</td>
	<td><input type="text" name="password" size="10"></td>
</tr>
<tr>
	<td>이름</td>
	<td><input type="text" name="name" size="10"></td>
	<td>이메일</td>
	<td><input type="text" name="email" size="10"></td>
</tr>
<tr>
	<td>주소</td>
	<td colspan="3"><input type="text" name="address" 
	                                          size="30"></td>
</tr>
<tr>
	<td colspan="4" align="center">
	<input type="submit" value="회원가입">
	</td>
</tr>
</table>
</form>
</body>
</html>
processJoining.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="chap11.member.MemberInfo" %>    
<%
	request.setCharacterEncoding("utf-8");

    //자바빈 객체 생성
    MemberInfo member = new MemberInfo();
    member.setId(request.getParameter("id"));
    member.setPassword(request.getParameter("password"));
    member.setName(request.getParameter("name"));
    member.setEmail(request.getParameter("email"));
    member.setAddress(request.getParameter("address"));
    
    //자바빈 객체 생성된 후 데이터가 정상적으로 저장되었는지
    //콘솔환경에서 확인하기 위해
    System.out.println(member);
    
%>    
<!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>자바빈 연습</title>
</head>
<body>
아이디 : <%=member.getId() %><br>
암호 : <%=member.getPassword() %><br>
이름 : <%=member.getName() %><br>
이메일 : <%=member.getEmail() %><br>
주소 : <%=member.getAddress() %>
</body>
</html>






chap11.war


+ Recent posts