변경한 소스만 올림니다. 나머지는 첨부파일~~!!
list.jsp
=======
<%@page import="com.seoulit.member.model.Member"%>
<%@page import="com.seoulit.member.action.ListForm"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
td{border : 2px solid blue;}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>리스트</title>
<script>
function deleteProecss(){
document.f.action = "delete.do";
}
function menuProecss(){
document.f.action = "menu.do";
}
</script>
</head>
<body>
<form action="info.do" name='f'>
<%--
<%
ListForm listform=(ListForm)request.getAttribute("listform"); //DAO에서 얻은 값을 arrayList에 담아서 request로 보낸것을 받음
// ${requestScope.listform} 와 같음
%>
--%>
<table>
<tr><td>선택</td><td>ID</td><td>PW</td><td>ADDR</td><td>TEL</td><tr>
<c:forEach var="member" items="${requestScope.listform.list}">
<tr>
<td><input type="radio" name="id" value="${member.id}"></td>
<td>${member.id}</td>
<td>${member.pw}</td>
<td>${member.addr}</td>
<td>${member.tel}</td>
</tr>
</c:forEach>
</table>
<c:if test="${requestScope.listform.previous}" >
<a href="list.do?pn=${listform.pagenum-1}"> ◀ </a>
</c:if>
<c:forEach var="pageNum" begin="${requestScope.listform.startpage}" end="${requestScope.listform.endpage}" >
<a href="list.do?pn=${pageNum}">${pageNum}</a>
</c:forEach>
<c:if test="${requestScope.listform.next}" >
<a href="list.do?pn=${listform.pagenum+1}"> ▶ </a>
</c:if>
<%-- //바꾸기전
<% if(listform.isPrevious()){ %>
<a href="list.do?pn=<%=listform.getPagenum()-1%>"> << </a>
<% }
int startpage=listform.getStartpage();
int endpage=listform.getEndpage();
for(int num=startpage; num<=endpage; num++){ %>
<a href="list.do?pn=<%=num%>"><%=num%></a>
<% }
if(listform.isNext()){ %>
<a href="list.do?pn=<%=listform.getPagenum()+1%>"> >> </a>
<% } %>
--%>
<br><input type='submit' value='수정'> <input type='submit'
value='삭제' onclick='deleteProecss()'> <input type='submit'
value='메뉴로' onclick='menuProecss()'>
</form>
</body>
</html>
menu.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>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>메인메뉴</title>
</head>
<body>
${requestScope.msg}
<h1>회원관리</h1>
<a href="list.do?pn=1">회원리스트</a><br>
<a href="joinset.do">회원가입</a><br>
<a href="login.do">로그인</a><br>
</body>
</html>
info.jsp //수정할때 한 명의 정보 가져오는 소스
=======
<%@page import="com.seoulit.member.model.Member"%>
<%@page import="java.util.ArrayList"%>
<%@ 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>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>수정 내용 입력</title>
<script>
function menu(){
document.f.action = "menu.do";
}
</script>
</head>
<body>
<form action="update.do" name="f">
<!--
Member info = (Member)request.getAttribute("info");
getAttribute를 info로 보내서 받았으므로 requestScope.info.id로 id를 받을수 있습
-->
<table>
<tr><td>ID</td><td><input type="text" name="id" value="${requestScope.info.id}" disabled="true"></td></tr>
<tr><td>PW</td><td><input type="text" name="pw" value="${requestScope.info.pw}"></td></tr>
<tr><td>ADDR</td><td><input type="text" name="addr" value="${requestScope.info.addr}"></td></tr>
<tr><td>TEL</td><td><input type="text" name="tel" value="${requestScope.info.tel}"></td></tr>
</table>
<input type="hidden" name="id" value="${requestScope.info.id}">
<input type="submit" value="수정"> <input type="submit" value="메뉴로" onclick="menu()">
</form>
</body>
</html>
loginset.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>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>로그인하기</title>
</head>
<body>
${requestScope.msg}
<form action="login.do">
<input type="text" name="id"><br>
<input type="text" name="pw"><br>
<input type="submit" value="로그인"><br>
</form>
</body>
</html>
'jsp' 카테고리의 다른 글
jquery 꼭 풀어봐야 할 예제들 (0) | 2013.11.08 |
---|---|
DB연동 회원가입,삭제 (0) | 2013.10.31 |
DB 연동 (0) | 2013.10.30 |
jsp와 db연동 (0) | 2013.10.28 |
선언문,request객체의메서드들,화면이동하기 (0) | 2013.10.23 |